I can't find at all where npm has its global settings stored.
npm config get userconfig
C:\Users\Jack\.npmrc
npm config get globalconfig
C:\Users\Jack\AppData\Roaming\npm\etc\npmrc
There's no files at either of these paths and yet
npm config get proxy -> returns my proxy url for work. which I want to delete.
npm config -g delete proxy
npm ERR! Error: ENOENT, unlink 'C:\Users\Jack\AppData\Roaming\npm\etc\npmrc'
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "config" "-g" "delete" "proxy"
npm ERR! cwd C:\f\Dropbox\apps
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! path C:\Users\Jack\AppData\Roaming\npm\etc\npmrc
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\f\Dropbox\apps\npm-debug.log
npm ERR! not ok code 0
It looks like the files
npm
uses to edit its config files are not created on a clean install, asnpm
has a default option for each one. This is why you can still get options withnpm config get <option>
: having those files only overrides the defaults, it doesn't create the options from scratch.I had never touched my
npm config
stuff before today, even though I had had it for months now. None of the files were there yet, such as~/.npmrc
(on a Windows 8.1 machine withGit Bash
), yet I could runnpm config get <something>
and, if it was a correctnpm
option, it returned a value. When I rannpm config set <option> <value>
, the file~/.npmrc
seemed to be created automatically, with the option & its value as the only non-commented-out line.As for deleting options, it looks like this just sets the value back to the default value, or does nothing if that option was never set or was unset & never reset. Additionally, if that option is the only explicitly set option, it looks like
~/.npmrc
is deleted, too, and recreated if youset
anything else later.In your case (assuming it is still the same over a year later), it looks like you never set the
proxy
option innpm
. Therefore, asnpm
'sconfig
help page says, it is set to whatever yourhttp_proxy
(case-insensitive) environment variable is. This means there is nothing todelete
, unless you want to "delete" your HTTP proxy, although you couldset
the option or environment variable to something else and hope neither breaks your set-up somehow.Have you tried running
npm config list
? And, if you want to see the defaults, runnpm config ls -l
.For me (being on Windows 10) the npmrc file was located in:
Tested with:
Even though we have the .NPMRC can be in 3 locations, Please NOTE THAT - the file under the Per-User NPM config location take precedence over the Global & Built-in configurations.
To find out which file is getting updated, try setting the proxy using the following command npm config set https-proxy https://username:password@proxy.company.com:6050
After that open the .npmrc files to see which file get updated.
Isn't this the path you are looking for?
C:\Program Files\nodejs\node_modules\npm\npmmrc
I know that npm outputs that , but the global folder is the folder where node.js is installed and all the modules are.
How to figure it out
Start with
npm root
-- it will show you the root folder for NPM packages for the current user. Add-g
and you get a global folder. Don't forget to substractnode_modules
.Use
npm config
/npm config -g
and check that it'd create you a new.npmrc
/npmrc
file for you.Tested on Windows 10 Pro, NPM v.6.4.1:
Global NPM config
Per-user NPM config
Built-in NPM config
References: