npm commands

Get npm version

npm -v (or --version)

Get help

npm help
npm

Create package.json

npm init
npm init -y (or --yes)

Set package.json defaults

npm config set init-author-name "YOUR NAME"
npm set init-license "MIT"

Get package.json defaults

npm config get init-author-name
npm get init-license

Remove package.json defaults

npm config delete init-author-name
npm delete init-license

Installing local packages

npm install lodash --save (or npm install --save lodash)
npm install moment --save
npm install gulp gulp-sass --save-dev

Move to another folder

npm install
npm install --production

Removing modules

npm uninstall gulp-sass --save-dev
npm remove gulp --save-dev

Installing certain version

npm install lodash@4.17.3 --save

Updating module

npm update lodash --save

Installing global module

npm install -g nodemon
npm install -g live-server

Running nodemon

nodemon

Finding root folder

npm root -g

Removing global packages

npm remove -g nodemon

Listing packages

npm list
npm list --depth 0
npm list --depth 1

Installing live-server locally

npm install live-server --save-dev

npm script

"scripts": {
    "start": "node index.js",
    "dev": "live-server"
  }