-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Nest can't resolve dependencies of the MikroOrmCoreModule (Symbol(mikro-orm-module-options), ?). Please make sure that the argument ModuleRef at index [1] is available in the MikroOrmCoreModule context. #30
Comments
I console logged out the options I passed into the MikroOrmModule static methods I used:
|
Looks like a dupe of: #27 |
It's a strange thing, but I was able to overcome this issue by starting my feature branch fresh. There was probably some implemenation quirk I ran into. I'm happy to close this issue (although I may open it back up if I come across it again). |
If you are using nest 8 then it is a dup of #27. If not, provide full repro. |
@hcharley what do you mean by "starting fresh" ? What exactly you did to make it work? I'm having the same issue and upgrading to v4.3 doesn't solve it. |
PrefaceI encountered this error and was stuck for a while, but recently figured it out and wanted to post my issue+solution in case someone else stumbles on it. The issueThe core issue was that I had multiple installations of nestjs, although they had the same version, but just in different folders. And then the mikro-orm packages were accessing a different installation of NestJS than my application. I think this led to the error that ModuleRef couldn't be found, because the ModuleRef that the mikro-orm modules wanted to use is from a different NestJS installation than the one that my application was actually providing. The reason it was so hard to figure out is that I am using yarn v1 workspaces and my application is just a single package within the workspace. And my package within the workspace had (for some unknown reason) its own installation of NestJS, whereas mikro-orm was properly hoisted (hoisting means the module is installed in the root of the workspace instead of just the individual package) and installed in the root of my workspace, in addition to the aforementioned separate installation of NestJS that was also hoisted and installed in the root of my workspace. So the structure looked like this:
And the confusing part was that the yarn.lock indicated that only a single version of the @nestjs/... packages were installed. Only after manually checking the directories I figured this out. How I solved itI could finally solve it by setting the So the package.json inside of my-subpackage finally looked like this:
Afterwards, it was important to remove the node_modules directories and remove the existing yarn.lock file, so that yarn actually applies the nohoist rules. Additionally, in case you encounter this error but aren't using yarn workspaces, my advice is just to go through the node_modules folders and figure out if there are any multiple versions of @nestjs/... or @mikro-orm/... packages installed, and if so, you'll have to figure out why and how to force NPM/Yarn (or whichever package manager of your choice) to only install a single version of these packages. Good luck! |
for
|
Describe the bug
I've tried several configurations, but I keep getting this error.
Stack trace
To Reproduce
DomainModule imports ResourceModule
Expected behavior
To see dependencies resolved
Additional context
Add any other context about the problem here.
Versions
The text was updated successfully, but these errors were encountered: