How to get list of globally installed npm packages

featured Image

In this article, we will learn how to get the list of globally installed npm packages on our computer.

While working with npm package we sometimes 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 packages installed on our computer.

To get the list of all the globally installed npm packages, we can use the command npm list -g. However, depending on the node version, we can use other flags to get the package name and its dependencies.

For node 6 and below

npm list -g --depth 0

npm : stands for the node package manager

list -g : list all the npm packages installed globally

--depth 0 : this flag is used to hide each installed package’s 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 hides 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

Related Posts

git commands with example

Top 40 Git commands with Examples

GitHub has become an essential tool for developers to manage, store, and collaborate with other developers on software projects. With its simple powerful git-based version control system, GitHub allows users…

Read more
Check GitHub Account in the Terminal

Check GitHub Account in the Terminal

GitHub is an integral tool for developers to store, manage, and collaborate on software projects with other developers. And as we work more and more in the command line it…

Read more
featured Image

How to make list of objects in Netlify CMS using list and object Widget

Here in this Netlify CMS tutorial we will how easily we can make a list of objects using list and object widgets. This will allow us to add multiple objects…

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *