我知道有很多有关该主题的问题和答案。但是到目前为止,没有任何回应似乎可以解决我的问题。
我正在尝试实现用于接收和发送消息的消息传递模块。我构造和注入模块的方式基于https://github.com/nestjs/mongoose如何使用forRoot和forFeature来实现。
可以在https://github.com/fea17e86/nestjs-issues/tree/cant-resolve-dependency上找到有效的例子,或者应该说不起作用。
在https://github.com/fea17e86/nestjs-issues/blob/cant-resolve-dependency/src/app.module.ts中发生Connection的注入,而在https://github.com/fea17e86/nestjs-issues/blob/cant-resolve-dependency/src/tweets/tweets.module.ts中注入Receiver。
这是完全例外:
[ExceptionHandler] Nest can't resolve dependencies of the TWEETS_RECEIVER (?). Please make sure that the argument at index [0] is available in the MessagingModule context.
Error: Nest can't resolve dependencies of the TWEETS_RECEIVER (?). Please make sure that the argument at index [0] is available in the MessagingModule context.
at Injector.lookupComponentInExports (C:\Workspace\fea17e86\nestjs-issues\node_modules\@nestjs\core\injector\injector.js:180:19)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:804:11)
at internal/main/run_main_module.js:21:11
在tutorial on how to use Mongoose中,您可以看到相同的模式,而MongooseModule.forRoot = MessagingModule.forConnection和MongooseModule.forFeature = MessagingModule.forReceiver。
预先感谢 fea