NPM: Package Management Cheat Sheet

npm iAlias for npm install
npm installInstall everything in package.json
npm install --productionInstall everything in package.json, except devDependecies
npm install lodashInstall a package
npm install --save-dev lodashInstall as devDependency
npm install --save-exact lodashInstall with exact

--save is the default as of npm@5. Previously, using npm install without --save doesn’t update package.json.

NPM: Install Names Cheat Sheet

npm i saxNPM package
npm i sax@latestSpecify tag latest
npm i [email protected]Specify version 3.0.0
npm i sax@">=1 <2.0"Specify version range
npm i @org/saxScoped NPM package
npm i user/repoGitHub
npm i user/repo#masterGitHub
npm i github:user/repoGitHub
npm i gitlab:user/repoGitLab
npm i /path/to/repoAbsolute path
npm i ./archive.tgzTarball
npm i https://site.com/archive.tgzTarball via HTTP

NPM: Listing Cheat Sheet

npm listLists the installed versions of all dependencies in this software
npm list -g --depth 0Lists the installed versions of all globally installed packages
npm viewLists the latest versions of all dependencies in this software
npm outdatedLists only the dependencies in this software which are outdated

NPM: Updating Cheat Sheet

npm updateUpdate production packages
npm update --devUpdate dev packages
npm update -gUpdate global packages
npm update lodashUpdate a package

NPM: Misc Features Cheat Sheet

npm owner add USERNAME PACKAGENAMEAdd someone as an owner
npm lslist packages
npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"Adds warning to those that install a package of old versions
npm update [-g] PACKAGEUpdate all packages, or selected packages
npm outdated [PACKAGE]Check for outdated packages