Weboldal keresés

typescript - NestJS: Nem található modul fejlesztői módban


Fejlesztői módban ezt a hibát kapom egy NestJS alkalmazásnál.

A konfigurációs fájlom a következő:

export const ORM_CONFIG: TypeOrmModuleOptions = {
  keepConnectionAlive: true,
  type: 'postgres',
  host: 'localhost',
  port: 5432,
  username: 'postgres',
  password: 'postgres',
  database: 'aimbra_education',
  schema: 'security',
  synchronize: true,
  entities: [
   --Entities
  ],
  // migrations: [__dirname + '/migration/**/*.ts'],
  // subscribers: [__dirname + '/subscriber/**/*.ts'],
};

Importálok ide:

@Module({
  imports: [
    TypeOrmModule.forRoot(ORM_CONFIG),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

Eddig nem tudtam azonosítani a hibát, hogy miért működik éles környezetben, és miért nem működik fejlesztői módban a módosításaim megfigyelésére.

Válasz #1

Megpróbálhatod ezt:

Például amikor készítek egy fájlt a nestjs cli-ből, úgy importálja az útvonalát, mint így:

import { UsersService } from 'src/modules/users/users.service';

olyan hibát ad, mint te.

Aztán amikor kézzel keresve cserélem ki az útvonalat:

import { UsersService } from './users.service';

a hiba javítva lett.