Table of Contents
NPM Commands
Abreviated version of npm install
npm i
Install
Install everything in package.json
npm install
Install everything in package.json, except devDependecies
npm install --production
Install a package
npm install lodash
Install as devDependency
npm install --save-dev lodash
Install with exact
npm install --save-exact lodash
--save is the default as of npm@5. Previously, using npm install without --save doesn't update package.json.
npm i sax
Specify tag latest
npm i sax@latest
Specify version 3.0.0
npm i sax@3.0.0
Specify version range
npm i sax@">=1 <2.0"
Scoped NPM package
npm i @org/sax
Install from GitHub
npm i user/repo
Install branch from GitHub
npm i user/repo#master
npm i github:user/repo
GitLab
npm i gitlab:user/repo
Install from repo on Absolute path
npm i /path/to/repo
Install from Tarball
npm i ./archive.tgz
Install from Tarball via HTTP
npm i https://site.com/archive.tgz
Listing
Lists the installed versions of all dependencies in this software
npm list
Lists the installed versions of all globally installed packages
npm list -g --depth 0
Lists the latest versions of all dependencies in this software
npm view
Lists only the dependencies in this software which are outdated
npm outdated
Updating
Update production packages
npm update
Update dev packages
npm update --dev
Update global package
npm update -g
Update a package
npm update lodash
Misc features
Add someone as an owner
npm owner add USERNAME PACKAGENAME
list packages
npm ls
Adds warning to those that install a package of old versions
npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"
update all packages, or selected packages
npm update [-g] PACKAGE
Check for outdated packages
npm outdated [PACKAGE]
Lock down dependency versions
npm shrinkwrap
Interactively create a package.json file
npm init
Locally edit a dependency
npm edit <module_name>
Setup editor for npm edit
npm config set editor "sublime"
Publish a package not under the default "latest" tag
npm publish --tag beta
Search the registry for packages matching terms
npm search [search terms]
Uninstall a package, completely removing everything npm installed on its behalf
Edit this page on GitHubnpm uninstall <name>