-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[BUG] npm install command automatically pruning packages even when package-lock config is disabled #3906
Comments
Even without the lockfile, npm has auto-pruned for many years on install. Disabling the lockfile doesn’t and hasn’t ever disabled that pruning behavior. |
@ljharb but the document above says that
And in npm@6 the install command won't prune packages (the behavior changed since npm@7) |
Interesting, i wasn’t aware of that (and i find that very confusing; I’d want to be able to both enable and disable pruning regardless of my lockfile setting) |
Yes, a new option to disable automatic pruning might be a better solution. |
Yeah, the documentation is definitely confusing here. For example, if I install multiple BUT if I try installing some local packages afterward (in the same directory, using EDIT: Looks like downgrading to |
Good job ;) |
The behavior did change in 7, intentionally. Disabling this would probably need to go through the rfc process. Docs will be updated #4845 |
Is there an existing issue for this?
Current Behavior
When install using install command with
package-lock
config disabled, the npm will still prune packages automatically and remove packages that did not appears in package-lock.jsonExpected Behavior
According to the document https://docs.npmjs.com/cli/v7/using-npm/config#package-lock , the automatically pruning should be disabled when
package-lock
config is disabledSteps To Reproduce
npm install --no-save --package-lock false lodash
lodash
module will be installed in thenode_modules
folder in the cwd folder, and package-lock.json is not creatednpm install --no-save --package-lock false underscore
underscore
module will be installed, but thelodash
module is removedEnvironment
The text was updated successfully, but these errors were encountered: