nest icon indicating copy to clipboard operation
nest copied to clipboard

Nest can't resolve dependencies

Open menme95 opened this issue 8 years ago • 2 comments

Current behavior

I'm trying to import a service in other service. They are in the same module:


@Module({
	imports: [MongooseModule.forFeature([{ name: 'users_new', schema: UsersSchema }]), MongooseModule.forFeature([{ name: 'resetpassword', schema: ResetPasswordSchema }]), GenericModule],
	controllers: [UsersController, AuthenticateController],
	providers: [UsersService, AuthService, Config,]
})

constructor(@InjectModel('resetpassword') private readonly resetPasswordModel: Model) {
	}

constructor(@InjectModel('users_new') private readonly userModel: Model, private readonly resetService: ResetPasswordService, private readonly config: Config)

This is the error: Nest can't resolve dependencies of the UsersService (+, ?, +). Please verify whether [1] argument is available in the current context. So I think the problem is in resetpassword service, Is there anything wrong?


[System Information]
OS Version     : Windows 7
NodeJS Version : v10.0.0
NPM Version    : 6.0.0
[Nest Information]
microservices version : *
websockets version    : *
mongoose version      : 4.0.0
passport version      : 1.0.10
swagger version       : 2.0.0
testing version       : *
common version        : 5.0.1
core version          : 5.0.1

menme95 avatar Jun 21 '18 07:06 menme95

The ResetPasswordService isn't defined in your @Module() metadata. Please, use StackOverflow (nestjs tag) for such questions.

kamilmysliwiec avatar Jun 21 '18 07:06 kamilmysliwiec

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Sep 24 '19 21:09 lock[bot]