Skip to content
Related Articles

Related Articles

Where does npm install the packages ?

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Easy
  • Last Updated : 14 Jul, 2021

NPM (Node Package Manager) is the default package manager for Node.js and is written entirely in Javascript. In this article, we will see Where does npm install the packages.

When we install a package using npm you can perform two types of installation:

  1. Local Installation
  2. Global Installation

Let’s understand each of them in detail.

1. Global Installation of packages: The global installation of dependencies in Node.js is putting global packages in a single place in the system exactly where depends on your setup regardless of where you run the command npm install -g <package-name> to install dependencies.



run npm install -g <package-name>

Here g denotes a global mode of a variable.

Example to illustrate How to install package globally in the system.

Write this command in the console.

 npm install -g express


Path of Global Packages in the system: Global modules are installed in the standard system in root location in system directory  /usr/local/lib/node_modules project directory.


Command to print the location on your system where all the global modules are installed.

npm root -g



To List all the Global Packages in the system:

npm list -g --depth 0 


2. Local Installation of Packages: Local packages are installed in the directory where you run npm install <package-name> and they are put in the node_modules folder under this directory.


npm install <package-name>

Example to illustrate How to install the package locally in the system.

npm install express


Path of Local Packages in the system: These all are installed in package.json file of the project locally as shown in the below image.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!