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
Jay 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

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay