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


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.

Categories: NodeJS

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts


Interceptor: Intercepting third party Request and Response on the Server side

In the previous post, we have seen 1) What are the interceptors? 2) How to intercept HTTP calls at the client side in Angular2 and Angular4? On the server side, there are scenarios where we need Read more…


NodeJS : Continuation Local Storage or Thread Local Storage?

Sometimes you need piece of data, most of the time request/response objects, between different events of a request where it is generally not accessible. Continuation Local Storage is a package to access the current express Read more…

Interview Questions

Nodejs Interview Questions

Important Interview Questions for Node.js 1) What is Nodejs ? 2) What is NPM ? 3) Different types of API’s exist in Node (api methods)? 4) What is event looping ? 5) What is event Read more…