pnpm: When installing only prod deps, don't download dev deps
Currently when installing with the --production
flag, dev deps are not linked into the node_modules
of the project. However, they are downloaded into the store. They should not be downloaded.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 15
- Comments: 18 (4 by maintainers)
Can we (after 3 years) at least avoid erroring out when devDependencies can’t be found?
That is because pnpm doesn’t always clean the cache at
node_modules/.pnpm
. You can use this setting to control it: https://pnpm.io/npmrc#modules-cache-max-age Thepnpm prune
should also work for removing cache.No, that seems like a bug in
pnpm ls
Seems like legitimate issues that should be fixed.
FWIW I do something like this now to bypass the issue:
Partially. The issue (as described in #2411, but this one actually seems to be the root cause in our case) is that we have a rush-managed monorepo where only our production dependencies are fully published. There’s a few devdependencies that only exist in the monorepo.
I’m currently investigating if we can move to pnpm workspaces instead (as we don’t have a hard requirement of publishing the dependencies at this time) but it would still be preferable to have an option that allows preparing a rush-managed package for production using pnpm (instead of npm, which does work fine, but doesn’t use the pnpm caching obviously)