Search code examples
typescriptnestjs

Nest can't resolve dependencies repository


I do have the next application: https://github.com/Aleonor1/barber-shop

Im getting the next error:

Nest can't resolve dependencies of the BarberRepositoryImpl (?). Please make sure that the argument BarberRepository at index [0] is available in the AppModule context.

Potential solutions:
- If BarberRepository is a provider, is it part of the current AppModule?
- If BarberRepository is exported from a separate @Module, is that module imported within AppModule?
  @Module({
    imports: [ /* the Module containing BarberRepository */ ]
  })

I dont know how to solve this, I tried to add the class in app module but it is not working. Help please

I tried to add the barber repository in AppModule and it is not working


Solution

  • You're missing the import of TypeOrmModule.forFeature([Barber]) to create the provider injected by @InjectRepository(Barber)