Reputation: 1056
In case an application has a package-lock.json or shripkwrap.json, both npm install/npm ci command would honor the dependencies versions (in package-lock.json or shripkwrap.json), what purpose would tilde(~) and caret(^) serve in package.json?
Upvotes: 3
Views: 427
Reputation: 124
Tilde ~
and caret ^
are used in package.json to say that your software is compatible with new patch or minor versions of a specific dependency.
But as you've identified, npm install
ignores new patch or minor versions when a package-lock.json file is present.
Instead, run npm update
.
This installs the latest version of any dependencies, based on how you've defined the version in package.json. It also updates package-lock.json accordingly.
Upvotes: 0