Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change npm globally installation path

Tags:

node.js

npm

Is it possible to change where you install your dependencies when doing npm install -g module? I know it installed in your C:/../{name}/Appdata..etc but I want to change the path on mine due to limited disk space.

I've installed node.js on an external disk which is fine and can do npm commands, but now I want the global dependencies to be installed on this disk as well.

Is there a way to do it?

like image 442
MrNew Avatar asked Dec 16 '16 09:12

MrNew


1 Answers

You can configure it to new PATH by the following command -

npm config set prefix '~/.npm-new-global'
like image 189
swapnesh Avatar answered Nov 07 '22 18:11

swapnesh