嵌套无法解析I18nLanguageInterceptor的依赖项 [英] Nest can't resolve dependencies of the I18nLanguageInterceptor
本文介绍了嵌套无法解析I18nLanguageInterceptor的依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将Nest升级到V8后,使nestjs-i18n工作时出现问题。
这是我收到的错误
Nest can't resolve dependencies of the I18nLanguageInterceptor (I18nOptions, I18nResolvers, I18nService, ?). Please make sure that the argument ModuleRef at index [3] is available in the I18nModule context.
Potential solutions:
If ModuleRef is a provider, is it part of the current I18nModule?
If ModuleRef is exported from a separate @Module, is that module imported within I18nModule?
@Module({
imports: [ /* the Module containing ModuleRef */ ]
})
- {"stack":["Error: Nest can't resolve dependencies of the I18nLanguageInterceptor (I18nOptions, I18nResolvers, I18nService, ?).
Please make sure that the argument ModuleRef at index [3] is available in the I18nModule context.
Potential solutions:
- If ModuleRef is a provider, is it part of the current I18nModule?
- If ModuleRef is exported from a separate @Module, is that module imported within I18nModule?
@Module({ imports: [ /* the Module containing ModuleRef */ ] })
版本:
"@nestjs/common": "^8.2.0",
"@nestjs/core": "^8.2.0",
"nestjs-i18n": "8.2.2",
"rxjs": "^7.4.0",
感谢您的帮助
推荐答案
基本上,当您有几个ModuleRef
类对象的值,使Nest查找错误的值时,会发生这种情况,这会导致x instanceOf ModuleRef
(大致在内部完成)返回false
这可能是因为您的项目中有两个@nestjs/core
NodeJS模块。
您可以通过执行以下操作找出这一点
ls -l node_modules/nestjs-i18n/@nestjs
## will display `core` (which is not expected)
ls -l node_modules/@nestjs
## will display `core` (which is expected)
(假设非monorepo项目)
这篇关于嵌套无法解析I18nLanguageInterceptor的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文