Can someone tell me where can I find the Node.js modules, which I installed using npm
?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- Keeping track of variable instances
If you're trying to access your global dir from code, you can backtrack from
process.execPath
. For example, to findwsproxy
, which is in{NODE_GLOBAL_DIR}/bin/wsproxy
, you can just:Global libraries
You can run
npm list -g
to see where global libraries are installed.On Unix systems they are normally placed in
/usr/local/lib/node
or/usr/local/lib/node_modules
when installed globally. If you set theNODE_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.If you are looking for the executable that npm installed, maybe because you would like to put it in your PATH, you can simply do
or
If module was installed with global (-g) flag, you can get parent location by running following command
or
which will print location along with list of installed modules
Cheers :-)
From the docs:
You can get your
{prefix}
withnpm config get prefix
. (Useful when you installed node with nvm).Read about locally.
Read about globally.
Not direct answer but may help ....
The npm also has a cache folder, which can be found by running
npm config get cache
(%AppData%/npm-cache
on Windows).The npm modules are first downloaded here and then copied to npm global folder (
%AppData%/npm/Roaming
on Windows) or project specific folder (your-project/node_modules
).So if you want to track npm packages, and some how, the list of all downloaded npm packages (if the npm cache is not cleaned) have a look at this folder. The folder structure is as
{cache}/{name}/{version}
This may help also https://docs.npmjs.com/cli/cache