← coderrocketfuel.com

Get a List of Globally Installed NPM packages on Your Machine

How can you get a list of all the globally installed NPM packages on your machine?

Open a terminal window and execute this command:

npm list -g --depth 0

This will output a list of all your globally installed NPM packages with their version number:

├── corepack@0.10.0
├── moment@2.29.1
├── nodemon@2.0.15
└── npm@8.1.4

Here's a breakdown of each part of the command:

  • list -g: tells NPM to only list global packages.
  • --depth 0: tells NPM to only return parent packages without a list of their dependencies.

Thanks for reading and happy coding!