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.
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.
node_modules installed globally are rooted in the library where sudo admin is necessary to access
/usr/local/lib/node_modules