When I install modules with NPM on Windows, it installs them to:
~/node_modules
I'd like to set change this to an arbitrary path such as:
c:\dev\repo\node_modules
I've tried
npm config set prefix <path>
With various values but none of them seem to work.
How does npm install packages globally? Global modules are installed in the /usr/local/lib/node_modules project directory in the standard system, which is the system's root. Print the location of all global modules on your system using this command.
zip. Extract this to the directory where NVM should be "installed". The default directory used by the installer is C:\Users\<username>\AppData\Roaming\nvm , but you can use whatever you like.
js documentation and found that it can be changed very easily using a simple "npm config" command. For example: npm config set prefix "E:\node_modules", From the next time onward, every global installation will save the node modules in "E:\node_modules" folder.
You can install a package locally if you want to depend on the package from your own module, using something like Node. js require . This is npm install 's default behavior.
As mentioned in the FAQ npm installs modules locally, to avoid dependency conflicts with nesting dependencies. If you really want different projects to reference the same copy you can use npm link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With