How to list npm user-installed packages?
List NPM packages with some friendly GUI!
This is what I personally prefer and it may be for others too, it may also help during presentations or meetings.
With npm-gui
you can list local and global packages with a better visualization.
You can find the package at
- npm-gui (npm)
- npm-gui (GitHub)
Run the following
// Once
npm install -g npm-gui
cd c:\your-prject-folder
npm-gui localhost:9000
Then open your browser at http:\\localhost:9000
You can get a list of all globally installed modules using:
ls `npm root -g`
npm list -g --depth=0
- npm: the Node.js package manager command line tool
- list -g: display a tree of every package found in the user’s folders (without the
-g
option it only shows the current directory’s packages) - --depth 0 / --depth=0: avoid including every package’s dependencies in the tree view
As of 13 December 2015
While I found the accepted answer 100% correct, and useful, I wished to expand upon it a little based on my own experiences, and hopefully for the benefit of others too. (Here I am using the terms package and module interchangeably)
In an answer to the question, yes the accepted answer would be:
npm list -g --depth=0
You might wish to check for a particular module installed globally, on Unix-like systems or when grep is available. This is particularly useful when checking what version of a module you are using (globally installed; just remove the -g
flag if checking a local module):
npm list -g --depth=0 | grep <module_name>
If you'd like to see all available (remote) versions for a particular module, then do:
npm view <module_name> versions
Note, versions is plural. This will give you the full listing of versions to choose from.
For the latest remote version:
npm view <module_name> version
Note, 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 update -g <package>
To update all global packages, you can use:
npm update -g
(However, for npm versions less than 2.6.1, please also see this link as there is a special script that is recommended for globally updating all packages.)
The above commands should work across NPM versions 1.3.x, 1.4.x, 2.x and 3.x.