-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Dependency resolution fails with @mikro-orm/cli
and pnpm
#81
Comments
I am not sure if this is something to fix at our end, the dependency definition is looking good to me, pnpm clearly installs multiple I mean, we could make the core/knex packages as peer deps for CLI, we do require it to be installed locally anyway, but it feels a bit breaking (global installation of the CLI package would probably fail with some type/import errors).
|
I have found others online who have similar issues with a myriad of nestjs modules because pnpm can resolve even pinned dependencies to different hashes. I agree trying to resolve this within the mikro-orm ecosystem is unnecessary and I'll close this issue. I will return to using yarn, or at least a package manager with a flat node_modules folder without all of the symlinking. |
It would be indeed good to support pnpm but I am having hard times to even debug this, when going thru the symlinks it looks good to me 🤷 But I was thinking how to get around this, but it all seems semi breaking, so would rather keep that for v6. But we could have the CLI package with only peer deps and change how we import things in that package to not fall apart in case the deps are not there (we just need nice error handling, no special functionality). The |
A user reported this on slack, and we found out it was caused by depending on wrong version of Maybe you had the same problem, will check the repro again to verify. I will have time for this next week probably, lets reopen so we dont forget. Want to give it another try knowing this information, I would very much like to solve this. |
@duckies |
Generally its not about installing this exact version, its about either not installing it at all, or dependeing on the same version as the driver does. And in this repro I don't see such problem, its quite bare bones... https://github.com/duckies/mikro-orm-cli-issue/blob/master/packages/server/package.json Maybe its some dependency that is shared with nest. |
Gave this another try, and pnpm is so weird. Only way I was able to make this work was by installing FYI this is not about the CLI package, I get the same issue if I remove it. To me this sound like a pnpm resolution bug. |
Looks like stating all the ORM packages as peer deps on the nestjs adapter helped - but it works only if I dont install the So if you have the |
@B4nan I can confirm that importing from the knex package and injecting SqlEntityManager works. In our case the |
Describe the bug
NestJS is unable to resolve
SqlEntityManager
in a pnpm monorepo only when@mikro-orm/cli
is installed.Stack trace
Reproduction (duckies/mikro-orm-cli-issue)
I created a minimal reproduction that should fail on
pnpm i && pnpm dev
, but will work once@mikro-orm/cli
is removed from the./packages/server/package.json
's dependencies and commands reran. I also included a yarn@v1 branch and NestJS is working with all dependencies installed.Additional context
I'm unsure if this is an issue with mikro-orm, pnpm, or otherwise. I know pnpm often duplicates, and thus breaks,
@nestjs/core
, but I don't think this is the case here.Versions
The text was updated successfully, but these errors were encountered: