Thursday, March 1, 2018

node.js - What's the difference between tilde(~) and caret(^) in package.json?



After I upgraded to latest stable node and npm, I tried npm install moment --save. It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix.





  1. Why are these changes made in npm?

  2. What is the difference between tilde ~ and caret ^?

  3. What is the advantages over others?


Answer



See the NPM docs




~version “Approximately equivalent to version”, will update you to the next patch version. See semver. ~1.2.3 will use releases from 1.2.3 to <1.3.0.




^version Will update you to the next minor version. See semver. ^2.3.4 will use releases up to 3.0.0. See Comments below.



No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...