How to check list of globally installed npm packages

In this article we will learn how to check list of globally installed npm package in our computer.

While working with npm package we sometime have to install some packages globally using -g or -global flag with npm install.

However with times, we may no longer use some global packages and want to remove them. To do that first we have to find out about the list of global npm package installed in our computer.

To get the list of all the npm packages that we have install globally we can use the command

For node 6 and below

npm list -g --depth 0

npm : stands for node package manager

list -g : list all the npm packages installed globally

--depth 0 : this flag is use to hide each installed packages dependencies. To show use --depth 1.

For node 7 and above

npm list -g

// or

npm list -global

In node 7 and above, you don't have to use the --depth 0 flag because npm list command already hide the dependencies of the installed npm packages by default.

However if you want to display all the dependencies of the installed global packages, you can run add --all config flag or just run

npm list -g --all

You can also use --depth 1 in node 7 too.

Related Topics:

How To Clear Cache In Npm?

Resolve - Node Unexpected Token Import Error

💾 Recommended Articles