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
pnpm install --prod
installs devDependencies
#2411
Comments
|
This happens because typescript is a peer dependency of ts-pnp (a subdependency of next). I am not sure we can solve this. |
I was looking at this too but could not figure out why |
Looking a bit closer;
..shouldn't it be evaluated as a peerDependency only if doing an install that should cover |
Maybe prod dependencies should never use dev dependencies to resolve their peer dependencies. But that would break a workflow that currently works. I'd rather leave it as it is. Peer dependencies are too complex currently. Also, npm wants to make some changes to peer dependencies, it wants to autoinstall them again. So I guess this current behavior of pnpm is kind of like that. |
Is there an upstream issue to read up on? |
I am personally not happy about it. Peer dependencies are so hard that I'd never touch them again |
Long read, but I agree with you.
I couldn't find a reference to production dependencies peeking into devDependencies for resolution though. Is there some other rfc other than the linked one? |
I'm also getting |
So, reading the rrfc about opt out for this scenario there seems to be progress on this matter. As I read @isaacs's comment, shouldn't |
I stumbled upon this issue after noticing 404 not found errors for internal devDependencies (rush monorepo), these packages are only ever referenced as devDependency, so it should not error out when trying to |
I am not sure it is worth fixing. There are too many edge cases. Let's assume there is bar that has foo as a peer dependency. In the following case, bar will resolve its peer depenendency both from a prod foo and a dev foo:
It is impossible to solve this problem in a way that will satisfy all use cases. If you really don't want foo to be linked into bar, I would recommend to remove foo from the peer depenendecies of bar, using a pnpmfile hook |
For others (hello, google) wanting to do the same - here's the relevant documentation. |
pnpm version:
Code to reproduce the issue:
Create a
package.json
containing something likeinvoke
pnpm install --prod
Expected behavior:
Similar to
npm
:Actual behavior:
Additional information:
typescript
fromdevDependencies
it doesn't get installed (assuming it would have gotten dragged along as a dependency ofnext
).prune
follows suit:The text was updated successfully, but these errors were encountered: