In Windows, I want to change the default global npmrc location, how can I do this?
Asked
Active
Viewed 1.5k times
4
-
Did you read https://docs.npmjs.com/configuring-npm/npmrc.html#per-user-config-file? – jonrsharpe May 18 '20 at 10:11
-
Yes, I want to define global file , not per user. – MightGod May 18 '20 at 10:16
-
But the path you describe is to the per-user file. The global file is next one down in the linked docs. – jonrsharpe May 18 '20 at 10:17
-
Where the global file is located in Windows? – MightGod May 18 '20 at 10:17
-
Looks like it's in AppData/Roaming by default: https://stackoverflow.com/q/15536872/3001761 – jonrsharpe May 18 '20 at 10:21
-
So this is the problem I'm facing, AppData it's a folder inside C:\Users\
, I want the global .npmrc file to be elsewhere – MightGod May 18 '20 at 10:23 -
Does this answer your question? [nodejs npm global config missing on windows](https://stackoverflow.com/questions/15536872/nodejs-npm-global-config-missing-on-windows) – Henke Jul 10 '20 at 06:39
-
Duplicate of [https://stackoverflow.com/questions/15536872](https://stackoverflow.com/questions/15536872). Right? - Downvoting instead of flagging as duplicate is not very helpful, I think. – Henke Jul 10 '20 at 06:47
1 Answers
5
I ran npm config set prefix C:\npm
to change the prefix of the global npmrc
location.
And then npm config get globalconfig
to get the exact expected global location (which is C:\npm\etc\npmrc
).
I navigated to this location and defined my global npmrc
there (I had to create the etc
folder myself.

MightGod
- 436
- 2
- 8
- 19