Cheat Sheets


Created: 2017 May 19th

Updated: 2019 March 1st

A list of terminal commands and flags to help me use npm

install package.json dependencies

GNU Bash icon
npm install


GNU Bash icon
# install
npm i <package>
# uninstall
npm un <package>
# update
npm up <package>

List globally installed packages.

GNU Bash icon
npm list -g --depth=0

list available scripts to run

GNU Bash icon
npm run

update npm

GNU Bash icon
npm install -g npm@latest
# using windows? Then use


-S is the same as --save not needed in npm 5+ -D is the same as --save-dev

installed version

GNU Bash icon
npm list # for local packages

Uninstall global package

GNU Bash icon
npm -g uninstall <name> --save

Upgrade NPM on Windows

After trying several times to upgrade npm on Windows I found this whilst poking around.

GNU Bash icon

Updating global packages

To update global packages individually you can use:

GNU Bash icon
npm update -g <package>

To see which packages need updating use:

GNU Bash icon
npm outdated -g --depth=0

dont rm -rf node_modules; npm install

Instead use:

GNU Bash icon
npm ci

It will have the same effect but be 2-3x faster

Bump version number

GNU Bash icon
npm version patch
# also | major | minor | patch