Node.JS – changing installation directory for global modules
Like many people I like to manage installation directory of programs which I install. I like to make sure that things are in CONTROL in my system and so it goes for all programs and their modules, plugins or packages I install. 🙂
Basically I need to know first where they are sitting in my system and once I know where they are and if I don't like that I put them somewhere else.
When we install modules globally in Node.JS it installs them at default location which is following in windows system:
Which translates to
and I don't like Node.JS installing my global packages at this location and to change that you have to make change file "npmrc" which was at following location in my system:
Open the file X:\<Your-Programs-Dir>\nodejs\node_modules\npm\npmrc, now you will see following line in this file:
Now change this path to whatever you want, like I changed it to following as I wanted it to be static at some location:
I like some of my programs to be installed on non-windows drive and so I choose different drive but generally I do not like development tools install something in Windows Roaming profile even if you install MySQL using installer it sets "data" directory default inside ProgramData in Windows which is following:
C:\ProgramData\MySQL\MySQL Server 5.x\Data\
I don't like this either, we will learn about how to change this in another post.
Looking forward to hear back from you if this tip helped and even if it did not.!