H
H
Hellas2017-10-25 09:11:09
npm
Hellas, 2017-10-25 09:11:09

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 updatethe 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

2 answer(s)
R
RidgeA, 2017-10-25
@RidgeA

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

I
Igor Zabrodin, 2017-10-25
@Rapt0p7

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 question

Ask a Question

731 491 924 answers to any question