A node application contains a file at the root level that holds the meta data related to project like project name, GitHub repository, scripts and the most important project dependencies.

The package.json manage your project dependencies with the package name and their version number.

For example:

"dependencies": {
"@angular/animations": "^4.2.5"
}

From the above dependency @angular/animation modules’s version consist of

Major_Version.Minor_Version.Patch_Version

Patch_Version : Some bug fixes with backwards compatibility

Minor_Version : Bug fixes + New features + Backward compatibility

Major_Version : There are breaking changes so test before applying this version

~ (tilde)

If dependency version has prefix ~ then it will lock the major and minor version and next time you run npm install or npm update, will install the latest patch version no matter what patch version is defined in dependency version.

Suppose if there is update in patch and version 4.2.6 is available then 4.2.6(latest) will be installed but major and minor version will be same.

^ (caret)

Dependency with ^ prefix lock the major version and install the latest minor version no matter what patch and minor version has defined in package.json

Without ~ and ^

If no prefix is defined then the same version will be installed as defined.

For more on the package.json visit the npm site.