Change default NodeJS - npm and npm-cache directory on Windows
Developers mostly like to take control of your machine and how things work on it. This time I decided to take control where NodeJS would restore my global packages and manages package cache. In this case I am referring to Windows 10 particularly as that is my core development platform. By default NodeJS gets installed in C:\Program Files\nodejs folder (assuming you are installing nodejs - Windows x64 version). After installation lets say I wish to install http-server package so I can run static HTTP server from any folder. As soon as I do npm install http-server -g, this start adding package and it's dependency packages into C:\Users\username\AppData\Roaming\npm and C:\Users\username\AppData\Roaming\npm-cache folder. So I wish to shift these two folders to different and custom location e.g: D:\nodejs. Let's do it! Step: Edit NPMRC file at follow location: C: » Read more