Closed sinedied closed 1 year ago
These are features that we could add to the linked install strategy! It just isn't possible to separate out the tree with the default hoisted install strategy. Would you be willing to start an RFC to get the ball rolling?
Can you create an RRFC in that rep with some details on how you would like to see this changed? Reference this issue. Thanks!
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I'm trying to achieve the same as asked in this SO question: https://stackoverflow.com/questions/70540116/how-do-i-install-dependencies-for-a-single-package-when-using-npm-workspaces
Basically I have a workspace with multiples packages, and I want to get only production dependencies for one of them in the context of packaging a container through a Dockerfile.
I tried running
npm ci --omit=dev -w <name>
, but the result is not the one I expected, as runningnpm ls --omit=dev -w settings-api
immediately after shows that it installed extraneous packages.Expected Behavior
Only production dependencies for the specified workspace should be installed.
Bonus point: in that context, there's also 2 missing features that would be helpful (sorry I couldn't find anywhere else to suggest them)
An option to disable hoisting the
node_modules
folder in the root folder, and keep it in the workspace folder (makes packaging easier and less error prone due to move/copy)An option to disable symlinking the workspace folder itself in the node_modules, as it's not desired in this context
Steps To Reproduce
npm ci --omit=dev -w settings-api
npm ls --omit=dev -w settings-api
:Environment
//registry.npmjs.org/:_authToken = (protected)
; "cli" config from command line options
location = "project"
; node bin location = /Users/sinedied/.nvm/versions/node/v18.12.1/bin/node ; node version = v18.12.1 ; npm local prefix = /Users/sinedied/projects/nest-docker-demo ; npm version = 9.2.0 ; cwd = /Users/sinedied/projects/nest-docker-demo ; HOME = /Users/sinedied ; Run
npm config ls -l
to show all defaults.