Where does npm install packages?


Question

Can someone tell me where can I find the Node.js modules, which I installed using npm?

1
812
12/12/2015 7:49:20 PM

Accepted Answer

Global libraries

You can run npm list -g to see which global libraries are installed and where they're located. Use npm list -g | head -n 1 for truncated output showing just the path.

On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node.

Windows XP - %USERPROFILE%\AppData\npm\node_modules
Windows 7, 8 and 10 - %USERPROFILE%\AppData\Roaming\npm\node_modules

Non-global libraries

Non-global libraries are installed the node_modules sub folder in the folder you are currently in.

You can run npm list to see the installed non-global libraries for your current location.

977
7/6/2019 12:22:03 PM

The command npm root will tell you the effective installation directory of your npm packages.

If your current working directory is a node package or a sub-directory of a node package, npm root will tell you the local installation directory. npm root -g will show the global installation root regardless of current working directory.

See the documentation.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon