Understanding NPM versioning

Basic:

Let’s say there is a version number like below:

1.2.3

The first digit indicate major version, which might not support backward compatibility.

The second digit indicate minor version, which is something like adding new feature and it is not breaking backward compatibility.

The third digit indicate patching, which could be bug patch.

^1.2.3 :

Fix the first digit.

You can use this when you want to make sure the library will not break  backward compatibility .

The maximum version will be downloaded is 1.9.9

~1.2.3:

Fix the first and second digits.

It only allows bug patch.

The maximum version will be 1.2.9

 

Advertisements