6

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

10 Answers 10

4

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
Sign up to request clarification or add additional context in comments.

Comments

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

1 Comment

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.
1

Try this

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

Comments

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.

Comments

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)

Comments

0
npm config rm proxy
npm config rm https-proxy
npm config rm http-proxy

Comments

0

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

npm config rm proxy -g
npm config rm https-proxy -g

Comments

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.

Comments

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

Comments

0

First, type this to see the current config:

npm config get

If you see any config about a proxy, you can delete that with the name of its key. In my case I had a line: registry = "http://172.16.10.54:4777" I deleted it with the command:

npm config delete registry

And that worked fine!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.