NPM tips

NPM

Save package exact version

Because a lot of node package are not using semver, it is a good practice to save package exact version.

npm install --save --save-exact  

or set the option globally

npm config set save-exact=true  

Do not use npm start for production

If you application intercept unix signals (SIGINT, SIGTERM) for clean exit do not use npm start to launch your app.

NPM shortcut

  • use npm i instead of npm install
  • use npm i -S instead of npm install --save
  • use npm i -D instead of npm install --save-dev
  • use npm r instead of npm uninstall