How to check if an npm package installed globally or locally (2024)

In this tutorial, we are going to learn about how to check whether an npm package (or module) is installed globally or locally using the npm list command.

Checking globally installed packages

To check for all globally installed packages and its dependencies, run the npm list command followed by the -g flag.

This above command prints the all globally installed packages in tree view.

To view the globally installed packages, without their dependencies use:

You can also check if a specific package is installed globally or not using the npm list -g followed by package name.

npm list -g express

Checking locally installed packages

To check for all locally installed packages and their dependencies, navigate to the project folder in your terminal and run the npm list command.

npm list

To view the locally installed packages, without their dependencies use:

npm list --depth=0

You can also check if a specific package is installed locally or not using the npm list command followed by package name.

npm list react
How to check if an npm package installed globally or locally (2024)
Top Articles
Latest Posts
Article information

Author: Mr. See Jast

Last Updated:

Views: 5906

Rating: 4.4 / 5 (55 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Mr. See Jast

Birthday: 1999-07-30

Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

Phone: +5023589614038

Job: Chief Executive

Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.