Common Node Package Manager (npm) commands.
# To download and install a module globally:
npm install -g <module_name>
# To download all dependencies referenced in package.json:
npm install
# To download a given dependency required for the application to run, and add it to the package.json:
npm install <module_name>@<version> --save
# To download a given dependency for development purposes, and add it to the package.json:
npm install <module_name>@<version> --save-dev
# To uninstall a module:
npm uninstall <module_name>
# To list a tree of installed modules referenced in package.json:
npm list
# To list top-level globally installed modules:
npm list -g --depth=0
# To interactively create a package.json file:
npm init
# ---
# To check a package for outdated dependencies:
npm outdated
# To update all outdated local packages:
npm update
# To update a package to the latest version:
npm install <package_name>@latest --save
# To update a dev package to the latest version:
npm install <package_name>@latest --save-dev
# To update all global packages by doing:
npm update -g
# To check for packages not declared in package.json:
npm prune
# To lock down your dependencies versions:
npm shrinkwrap
# To search for packages:
npm search <package_name>
# To see where modules go:
npm root
# To see where executables go:
npm bin
# To list installed packages:
npm ls