Terminal: npm
Working in the terminal with web development, you’ll likely be running into Node and the Node Package Manager (npm) sooner or later. This is a standardized way to install and utilize JavaScript-based software, and this is a summary of some useful commands.
Packages can be installed globally or per project.
Global packages
-
List all globally installed packages
npm list -g --depth=0 -
You can check for a particular module installed globally. This is particularly useful when checking what version of a module you are using globally (remove the
-gflag if checking a local module):
npm list -g --depth=0 | grep <module_name>
Packages
-
If you’d like to see all available (remote) versions for a particular module, then do:
npm view <module_name> versions.
Note that versions are in the plural. This will give you a complete listing of versions to choose from. -
For the latest remote version:
npm view <module_name> version
Note that the version is singular. -
To find out which packages need to be updated, you can use
npm outdated -g --depth=0 -
To update global packages, you can use
npm install -g <package> -
To update all global packages, you can use:
npm update -g
Another way would be to use npm-check-updates (or ncu for short).