I'm new to Angular, and I can see some special characters in "package.json" file next to each library version. Some are start with "^" ( "@angular/compiler-cli": "^4.3.5" ) and some are with "~" ("@types/node": "~6.0.60"). Why we are using and what is the different ?
Asked
Active
Viewed 477 times
0
-
Possible duplicate of [What's the difference between tilde(~) and caret(^) in package.json?](https://stackoverflow.com/questions/22343224/whats-the-difference-between-tilde-and-caret-in-package-json) – Vikas Mar 17 '18 at 06:59
1 Answers
1
In simple words
Suppose you want to install package "abc"
Versions of "abc" package are
1.0.0
1.0.1
1.0.2
2.0.0
2.0.1
If you write this =>
~1.0.0 then It will pick latest version of 1.0.x series
~1.0.0 = ~1.0.2
If you write this =>
^1.0.0 then It will pick recent version of "abc" package
^1.0.0 = 2.0.1

Nishant Dixit
- 5,388
- 5
- 17
- 29