npm 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:
- save it in my package.json
- 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.
This post was originally published at ricca509.me.