Home >Web Front-end >JS Tutorial >Where Are My npm-Installed Node.js Modules Located?
Locating Node.js Modules Installed with npm
Introduction:
When installing packages using npm, it's essential to be aware of their location. This knowledge allows developers to troubleshoot issues, access documentation, and manage dependencies effectively.
Global Modules:
To view the list of globally installed Node.js modules, execute the following command:
npm list -g
These modules are typically installed in the following directories:
Non-Global Modules:
Packages installed without the -g (global) flag are non-global modules. These are stored in a subfolder named node_modules within your current working directory.
To view a list of non-global modules, run the command:
npm list
Installing Globally:
To ensure a module is installed globally, use the -g option during installation, as seen in the example below:
npm install -g pm2
Viewing Global Directory:
To confirm the location of globally installed modules, execute the following command:
npm root -g
The above is the detailed content of Where Are My npm-Installed Node.js Modules Located?. For more information, please follow other related articles on the PHP Chinese website!