NPM is the package manager for nodejs modules. It is used to install, update and remove packages from a nodejs application. In this tutorial you will learn how to find installed package version of modules on your system.
You can use npm list command to search for local packages and npm list -g for globally installed packages.
npm list ##List all locally installed packages npm list -a ##List all globally installed packages
Find specific package version
You can find the version of a specific package by passing its name as an argument. For example, npm list grunt will result in:
npm list oauth `-- [email protected]
Find all packages version
Alternatively, you can just run npm list without passing a package name as an argument to see the versions of all the packages installed in your current project. Use
-g to find globally installed packages.
| +-- [email protected] | | `-- [email protected] | +-- [email protected] | | `-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | | `-- [email protected] | | `-- [email protected] | +-- imu[email protected] | +-- [email protected] | | +-- [email protected]
Above list shows all the packages installed including there dependencies
You can also add
--depth=0 argument to list installed packages without their dependencies.
npm list --depth=0
Find packages require updates
To find out which packages need to be updated, you can use npm outdated command to list all packages installed with older versions.
npm outdated --depth=0 ##For locally installed packages npm outdated -g --depth=0 ##For globally installed packages