DEV Community

Jouini Hamza
Jouini Hamza

Posted on

nestjs frustrating modules

i don't know why sometimes i get some errors in nest like "Nest can't resolve dependencies " while i provided the dependencies in the modules chez this is frustrating nonsense bugs

@Module({
imports: [
MongooseModule.forFeature([{ name: Notification.name, schema: NotificationSchema },{ name: Event.name, schema: EventSchema }]) ,
forwardRef(() => UserModule ), <-- exported the userservice
forwardRef(() => AuthModule ),
],
exports: [NotificationService],
providers: [NotificationGateway, NotificationService]
})

and yet nest tells me that it can't resolve userservice

Top comments (3)

Collapse
 
jmcdo29 profile image
Jackie McDoniel •

If I had to bet, you don't have @Inject(forwardRef(() => UserService)) in your service. Without the full error and the constructor though, couldn't say. There are more docs on common errors that you may find useful

Collapse
 
xfchris profile image
christian •

go back to Adonis.js :'D :'D :'D

Collapse
 
sihamza profile image
Jouini Hamza •

and use knex.js as ORM hell now xD