Npm install – – save

I have been working on with Node.js and Express for almost a year now. Thanks to Sreeram ( who wanted Talentify ( to be built using Node.js.

There is this package.json file in Express, wherein you can specify all the dependent node modules. Once the dependencies have been listed, you have to give the command npm install before launching your Express app. This loads all the dependent node modules.

This is a code snippet from package.json

"dependencies": {
"primus": "*",
"async": "~0.8.0",
"express": "4.2.x"

Often I used to wonder, how to get the exact version number for a node module. I started with a “*” next to each node module, just to ensure that the latest version of the node module gets installed.

Few days back, it so happened that I was looking for a particular version of Express, and Ubuntu never installed the right(latest) version for me. I then learned about this command npm install --save express@4.x.x. This command installed the right version of express which I was looking for.

The --save option was so handy. I then learned that issuing this command npm install --save would also create an entry in package.json file with the appropriate version.

I don’t have to bother about the version numbers for node modules henceforth, --save option does that for me. NPM sounds so simpler after that.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: