You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The npm install command does not synchronize package versions between package.json and lock files.
The lock file ignores changes in package.json which makes it impossible to safely upgrade / downgrade a package directly from package.json.
This issue is present in all NPM projects and it's been discussed since 2017: npm/npm#16866
The issue was closed but never resolved. As people mentioned there, the package.json file should be the source of truth and the lock file should sync on either npm install or npm update.
Expected Behavior
Be able to upgrade / downgrade packages by changing the version directly in package.json and then running either npm install
Steps To Reproduce
Change package version of any module in package.json: "vue": "^2.6.12" => "vue": "^2.6.13"
Run npm install
Try to downgrade back to 2.6.12 by changing the package.json again
Run npm install
The project is still using 2.6.13 since the lock file didn't sync
Environment
OS: x64 Win 10 21H1
Node: 15.14.0
npm: 7.13.0
The text was updated successfully, but these errors were encountered:
Hi @aleksey-hoffman thank you for taking the time to write this report.
The expected behavior of a npm install is to respect lock files, with that in mind I don't see any unexpected behavior.
From what I understood of your reported "Expected Behavior" I would rather recommend using npm install <pkg>@<version>, from your example that should be: npm install vue@2.6.12 - this should successfully downgrade/upgrade any package in both node_modules, package.json and package-lock.json files.
Is there an existing issue for this?
Current Behavior
The
npm install
command does not synchronize package versions betweenpackage.json
andlock
files.The
lock
file ignores changes inpackage.json
which makes it impossible to safely upgrade / downgrade a package directly frompackage.json
.This issue is present in all NPM projects and it's been discussed since 2017: npm/npm#16866
The issue was closed but never resolved. As people mentioned there, the
package.json
file should be the source of truth and thelock
file should sync on eithernpm install
ornpm update
.Expected Behavior
Be able to upgrade / downgrade packages by changing the version directly in package.json and then running either
npm install
Steps To Reproduce
"vue": "^2.6.12"
=>"vue": "^2.6.13"
npm install
2.6.12
by changing the package.json againnpm install
2.6.13
since the lock file didn't syncEnvironment
The text was updated successfully, but these errors were encountered: