What's the difference between a tilde (~) and a caret (^) in the package.json file?
Asked by Omar Cheema · · 2 answers
^ include everything greater than a particular version in the same major range.
~ include everything greater than a particular version in the same minor range.
Allow or disallow changes
- Pin version:
^(like head). Allows updates at the second non-zero level from the left:
0.2.3 <= v < 0.3.
~(like tail). Generally freeze right-most level or set zero if omitted:
1.0.0 <= v < 2.0.0
1.2.0 <= v < 1.3.0.
1.2.4 <= v < 1.3.0.