What's the difference between tilde(~) and caret(^) in package.json?
Asked 07 September, 2021
Viewed 2.9K times
  • 56
Votes

After I upgraded to the 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 are the advantages over others?

19 Answer