Node package manager supports semantic versioning. To take full advantage of it, you can use the symbols tilde(~) or caret(^).
Tilde(~) means approximately equivalent to version.
"moment": "~2.29.1"
In this example npm install
will pick up the latest release of the module moment
starting from 2.29.1
but never
higher than 2.30.0
.
Caret(^) means compatible with version.
"canvas": "^2.6.1"
Here, the installed version of the module canvas
could range from 2.6.1
to less than 3.0.0
.
This way npm
ensures the compatibility of your code with the third party module.