Useful npm commands

These are few npm command line commands for Node that I use few times a week to keep my packages up to date with latest versions.

Updating NPM version in Windows:
npm install -g npm

Updating NPM version in Linux / Mac OSX:
sudo npm install -g npm

Finding versions of global modules:
npm list -global --depth 0

Update Specific package. For e.g. core-js
npm update core-js –save

Update all packages
npm update --save

Find outdated packages
npm outdated

 

Installing all Dev Dependencies
--save-dev

Installing all regular dependencies.
--save installs

 

What are Dev Dependencies ?
Everything we will require during development. For e.g. testing frameworks, transpilers, etc.

What are Regular Dependencies ?
Everything needed for the application to run in production. For e.g. jQuery, React, etc. that the application will need to run in production