Save the exact version of a module with npm

npm node.jsnpm is definitely a very useful tool, but its default behaviour is more tailored for module development than for applications.

What I’d like it to do every time I install a dependency is:

  1. save it in my package.json
  2. install the exact version of the module, without any caret ^

Both are achieved with:

npm install myModule --save --save-exact

Typing this every time is annoying, but with the use of ~/.npmrc this behaviour can become a default:

$ npm config set save=true
$ npm config set save-exact=true

This will do the trick, and now every time you

npm install myModule

it will install the exact version (no ^) and save it in package.json.
Happy dev!

This post was originally published at

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s