Celeb Glow
news | April 01, 2026

what is the location of node-modules

I want to see my all packages and modules of node-module. Please tell me its the location in ubuntu 18.04. such as /path/to/node-module. Moreover, How to see the code of modules such as http module or fs module.

3 Answers

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 -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.

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.

1

node_modules installed globally are rooted in the library where sudo admin is necessary to access

/usr/local/lib/node_modules

You can see the local location like this:

$ npm root
/home/<user>/<path>/node_modules

and the global location like this:

$ npm root -g
/usr/lib/node_modules

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy