Answer the question
In order to leave comments, you need to log in
How to prevent npm from updating package versions in package.json?
In my package.json, all packages have version "*" - that is, always update to the latest.
When npm update
the versions of the updated packages are changed to those that were installed.
How to avoid it?
Answer the question
In order to leave comments, you need to log in
You can try npm i ... --save-prefix=">=" in theory this should always update to the latest version.
https://docs.npmjs.com/misc/semver
you can also set it by default
npm config set save-prefix ">="
but it's still bad practice to update packages so freely - the package author can break compatibility, especially when major version change
According to the documentation : * - Matches any version
To update to the latest release version, try latest , but you need to be sure that updating certain packages will not break the current code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question