How to list npm user-installed packages?

Better Stack Team
Updated on March 11, 2024

To list npm user-installed packages, you can use the npm list command in the terminal. By default, this command will show a tree-like structure of all installed packages for the current project. If you want to see a list of globally installed packages (user-installed), you can add the -g flag.

Here are the commands:

List User-Installed Packages Locally:

 
npm list

This command will display a tree structure of locally installed packages for the current project.

List User-Installed Packages Globally:

 
npm list -g --depth=0
  • g flag indicates global packages.
  • -depth=0 flag specifies that you only want to see top-level packages without their dependencies.

Alternatively, you can use the following command to list globally installed packages without the dependencies:

 
npm -g ls --depth=0

These commands will output a list of globally installed packages along with their versions. If you want more details, you can remove the --depth=0 flag, and npm will display the entire dependency tree.

Remember that the exact command might vary slightly based on your operating system and terminal environment.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github