Package management

CommandDescription
npm iAlias fornpm install
npm installInstall everything in package.json
npm install --productionInstall everything in package.json, except devDependecies

Adding packages

CommandDescription
npm install lodashInstall a package
npm install --save-dev lodashInstall as devDependency
npm install --save-exact lodashInstall with exact

Listing

CommandDescription
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

Updating

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

Removing

CommandDescription
npm rm lodashRemove package production packages

More features

Install names

CommandDescription
npm i saxNPM package
npm i sax@latestSpecify taglatest
npm i sax@3.0.0Specify version3.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

Bumping versions

CommandDescription
npm version 1.2.3Bump the package version to 1.2.3
npm version majorBump the major package version by 1 (1.2.3 → 2.0.0)
npm version minorBump the minor package version by 1 (1.2.3 → 1.3.0)
npm version patchBump the patch package version by 1 (1.2.3 → 1.2.4)

Misc features

# Add someone as an ownernpm owneradd USERNAME PACKAGENAME
# list packagesnpmls
# Adds warning to those that install a package of old versionsnpm deprecate PACKAGE@"< 0.2.0""critical bug fixed in v0.2.0"
# update all packages, or selected packagesnpm update[-g] PACKAGE
# Check for outdated packagesnpm outdated[PACKAGE]