Vadorequest Vadorequest - 2 months ago 16
Node.js Question

How to force npm to install specific version of package by default?

Is there a way to config npm not to install package using a lazy version like:

"coffee-script": "^1.11.1",


"coffee-script": "1.11.1",

And have this behavior become the default one? We usually don't want to use lazy versions, I prefer to manually upgrade everything to the latest from time to time rather than having a bug thrown up at my face after a new deployment due to a bug in one of my dependencies.

The only way to "do that" right now is to manually remove the
character every time after every
npm install
, which is a bit boring.


This is the command that will set a user variable in your npm configuration to always default to use the exact version when performing an npm installation of all packages.

Enter this command in your terminal:

npm config set save-exact=true

The new preference is stored in a user-based custom npm configuration file. It is located here:


Finally, you can verify the setting was saved with the command:

npm config ls

Official NPM docs here: