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

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay