Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active December 8, 2021 12:40
Show Gist options
  • Save garystafford/d540540b6863e4ab6200 to your computer and use it in GitHub Desktop.
Save garystafford/d540540b6863e4ab6200 to your computer and use it in GitHub Desktop.
My list of helpful node/npm/bower commands
###############################################################################
# Helpful npm commands and code snippets
###############################################################################
# list top level packages w/o dependencies
npm list --depth=0
npm list --depth=0 -g
# list top level packages that are outdated w/o dependencies
npm outdated | sort
npm outdated -g | sort
# install packages
npm install -g <pkg>@<x.x.x>
npm install -g <pkg>@latest
# update packages
npm update --save
npm update --save-dev
npm update -g <pkg1> <pkg2> <pkg3>
# Update to latest dependencies, ignore and update package.json!
npm install -g npm-check-updates
npm-check-updates
npm-check-updates -u
npm update # verify new versions work with project
# prune and rebuild
npm prune
npm rebuild
npm rebuild -g
# find package dependencies
npm ls <pkg>
# alternate tool to check and update dependencies
npm install -g david
david -g
david update -g
bower list | sort
bower update
bower prune # uninstalls local extraneous packages
# lists available tasks
grunt --help
@pzmosquito
Copy link

pzmosquito commented May 18, 2016

"npm outdated" shows depth 0 by default, no need to specify --depth=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment