Open sgerace opened 1 year ago
Hello, I'm having the same issue using npm 8.0.0. Is there any progress on the topic? Is there any suggested workaround this?
This could be similer to https://github.com/npm/cli/issues/6690, keeping it open for now. If the identified root cause is the same for the other then, We'll close it as duplicate.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When installing with
npm install --workspaces=false
, if the root package has no dependencies (neitherdependencies
nordevDependencies
then the--workspaces=false
is ignored and the workspace packages are installed.Please note that I encountered this behavior while developing a reproducible example for #6690, so they may be related, but this seemed like a distinct issue so I decided to report separately (please feel free to close if it turns out to be related to the same root cause).
Expected Behavior
I would expect the
--workspaces=false
flag to ignore all workspaces and install ONLY dependencies and devDependencies provided in the root package.json.Steps To Reproduce
package.json
at the project root and one workspace:Project structure:
./package.json
contents:./workspace-a/package.json
contents:npm install --workspaces=false
In this case, I would not expect any modules to be installed since workspaces should be ignored and there are no dependencies listed in the root
project.json
file. However, when I run this command,express
and its dependencies are installed.package.json
to include a package:./package.json
contents:Running
npm install --workspaces=false
will now only install theinherits
package (andexpress
will not be installed).Environment