0
votes

I went back to a small project after a month. I updated nestjs and npm but the app don't start. I reverted it and it works well. On the initialization of the project (npm run start), it stops at : "[Nest] 13012 - 2019-06-15 16:01 [InstanceLoader] TypeOrmModule dependencies initialized +1ms" and don't go further.

Here is the link for my repo : https://github.com/Ithrandil/coffeeshareBE I really don't know what to try and did'nt found any specific bug report on Nestjs repo.

I've went from the 6.0.0 to the 6.3.1 version on nestJs.

Here is the different updates :

2

2 Answers

0
votes

You don't have TypeOrm dependency declared in your package.json, are you using this ORM with Nest? If so you need to specify it via yarn or npm and it will be added as dependency in your package.json file.

For instance, add the dependency of TypeOrm in your deps:

"typeorm": "^0.2.18"

And see if it solves everything or just brings to another problem.

0
votes

It looks like the issue is with the way you're injecting the custom repository UserRepository.

First, in your user repository, delete the constructor, and change the class declaration to look like this:

@EntityRepository(User)
export class UserRepository extends Repository<User> {

Then, in your user module, change your module to look like this:

@Module({
  imports: [TypeOrmModule.forFeature([User, UserRepository])],
  controllers: [UserController],
  providers: [UserService],
  exports: [],
})
export class UserModule {}

Then, in your user service, change your constructor to inject the repository like this:

constructor(
  @InjectRepository(UserRepository)
  private readonly userRepo: UserRepository,
) {}

For more information, here is a related issue I found: https://github.com/nestjs/typeorm/issues/44