5

In work I have a proxy and set this in npm

 npm config set proxy http://theproxy:8080
 npm config set https-proxy https://theproxy:8080

Out of work I don't have the proxy and need to remove it in npm.

I've tried

 npm config rm proxy
 npm config rm https-proxy

and

 npm config delete proxy
 npm config delete https-proxy

but when I use

 npm config get proxy
 npm config get https-proxy

the proxy is still there

How do I remove the proxy in npm

ttmt
  • 5,822
  • 27
  • 106
  • 158

9 Answers9

3

Below things worked for me, make sure environment variable HTTP_PROXY is unset before removing config entries

Unsetting HTTP_PROXY= is very important

set HTTP_PROXY=
npm config rm proxy
npm config rm https-proxy
npm config rm http-proxy
Chandre Gowda
  • 870
  • 1
  • 7
  • 24
1

It works very well for me ..

saidas-mbp:trunk saidababuchanda$ npm config set proxy https://www.google.com
saidas-mbp:trunk saidababuchanda$ npm config get proxy 
https://www.google.com
saidas-mbp:trunk saidababuchanda$ npm config delete proxy 
saidas-mbp:trunk saidababuchanda$ 
saidas-mbp:trunk saidababuchanda$ npm config get proxy 
null
saidas-mbp:trunk saidababuchanda$ npm -v
1.4.14
saidas-mbp:trunk saidababuchanda$ 

Please look at your npm version

  • If I do `npm config ls -l ` I get a list of all settings which includes `proxy = "proxy.theproxy.co.uk:8080" `. If I do `npm config set proxy https://www.google.com ` and then `npm config ls -l ` google.com is set as the proxy but I still have `; proxy = "proxy.theproxy.co.uk:8080" (overridden) `. I have version 1.4.14. Is it a good idea to delete the npm install, will that help in any way. – ttmt Dec 10 '14 at 09:00
1

Try this

npm config delete proxy
npm config delete proxy -g
npm config delete https-proxy
npm config delete https-proxy -g

Manfye Goh
  • 11
  • 1
1

In my case the issue was trying to delete the proxy while I was in specific folder project that contains .npmrc file. Inside the file there was proxy definition for this specific folder. So I removed the proxy definition inside.

Israel
  • 445
  • 2
  • 5
  • 15
0

I doubt , it is set somewhere in your npmrc files , can you check below files?to see if this value is set somewhere.

npmrc Files

The four relevant files are: per-project config file (/path/to/my/project/.npmrc) per-user config file (~/.npmrc) global config file ($PREFIX/npmrc) npm builtin config file (/path/to/npm/npmrc)

0
npm config rm proxy
npm config rm https-proxy
npm config rm http-proxy
Joe Sleiman
  • 2,416
  • 5
  • 25
  • 40
0

I think your issue is you need to remove it globally. Try:

npm config rm proxy -g
npm config rm https-proxy -g
joshmcode
  • 3,471
  • 1
  • 35
  • 50
0

Three steps solution.

What worked for me is setting the proxy to an empty string / url, then I used npm config delete to remove the https-proxy setting.

So i ran the following commands:

npm config set proxy
npm config delete https-proxy -g

Additionally you can run npm config list to verify that the values indeed have been removed.

Now one last thing, you need to run the following command:

npm config edit

A file will open on your default text editor, in that file remove any proxy configurations added by you.

Community
  • 1
  • 1
zeezor
  • 51
  • 5
0

I tried all the solutions in this thread but it didn't work. The issue was that proxy settings were commented in my "C:\Users\YOURNAME.npmrc" file. Uncommenting it worked for me.

proxy=null

https-proxy=null

boms
  • 91
  • 1
  • 11