-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Injection of core-providers not possible #7568
Comments
Please provide a minimum reproduction? |
I have the same problem in nest 8.x (tested with node 14 and node 16). Steps to reproduce:
The example directory use the builded module via If you want to check that with nest 7.x works well you can checkout to an old release:
|
This is working fine for me on a minimum reproduction, so I can only assume it's something in your code base. File links for package.json works rather strangely with Nest due to how these packages and their peer dependencies end up getting resolved, so a word of caution there. But, with a very basic |
I cloned cqrs module, and build it. I have the same error when I load it with path instead version in package.json:
and we get the same problem (and this didn't happens in 7.x). So this seems only a problem with local load. The point is that local load is useful when you are development a nestjs module. |
I did a workaround linking the local module src inside the example directory (instead using a local load in package) and it works. So this is not anymore an issue for me. Thanks for your time and support @jmcdo29. |
Nest v8 no longer stringifies class names but rather uses class references to connect injectables. That means all Nest packages should be defined as peer dependencies in case you want to share them (instead of having each package with its own copy of Nest deps). |
Thanks for the fast reply @kamilmysliwiec. When having a package.json like that: "peerDependencies": {
"@nestjs/core": "^8.0.2",
"@nestjs/common": "^8.0.2"
},
"devDependencies": {
"@nestjs/cli": "^8.0.2",
"@nestjs/core": "^8.0.2",
"@nestjs/common": "^8.0.2",
"@nestjs/schematics": "^8.0.1"
}
} It still does not resolve the dependencies with the same error. |
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements. Just FYI: |
Bug Report
Current behavior
After upgrading to 8.x.x, the injection of core providers like
ModuleRef
orModulesContainer
into normal Injectables is not possible anymore. Nothing changed, except upgrading@nestjs/core
and others to 8.Seems to happen here to: skunight/nestjs-redis#82
Input Code
Environment
Nest version: 8.0.0/8.0.1/8.0.2
The text was updated successfully, but these errors were encountered: