1

enter image description here

I have this error in development mode of an application with NestJS.

My configuration file is as follows:

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'],
};

I import into:

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

So far I couldn't identify the error of why it works in production and doesn't work in development mode to watch my modifications.

5
  • check if paths imports have the prefix "src/..." if is there replace it for manually location "../../..." Sep 2, 2019 at 0:14
  • import { Entity, PrimaryGeneratedColumn, Column } from '../../../node_modules/typeorm'; I tried to add, but it still didn't work ... Sep 2, 2019 at 0:23
  • not for node_modules, try with yours services,controllers,modules,entities files Sep 2, 2019 at 0:25
  • could you provide your tsconfig.json file content please ?
    – A. Maitre
    Sep 2, 2019 at 10:14
  • 1
    DO NOT post images of code, data, error messages, etc. - copy or type the text into the question. stackoverflow.com/help/how-to-ask
    – Rob
    Oct 24, 2019 at 1:30

1 Answer 1

7

You could try this:

For example when i make some file from the nestjs cli, there import his path like this:

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

giving the error like you.

enter image description here

Then when i replace the path to find it manually:

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

the error is fixed. enter image description here

2
  • Many thanks for the reply. But, I wonder if there is any way to change this reference? To not have to be manually importing ... Oct 13, 2019 at 23:48
  • 5
    DO NOT post images of code, data, error messages, etc. - copy or type the text into the question. stackoverflow.com/help/how-to-ask
    – Rob
    Oct 24, 2019 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.