Allan Ruin
Allan Ruin

Reputation: 5287

How to clear https proxy setting of NPM?

How can I clear the previous ssl proxy setting of NPM? well, I search a lot, but all post I got is mainly about how to set proxy in corporate network.

I try to set proxy to nothing:

npm config set http-proxy
npm config set https-proxy

the first command pass yet the second one warn that:

npm WARN invalid config proxy=""
npm WARN invalid config Must be a full url with 'http://'

is the warning neglectable and I have successfully clear the proxy setting?

Upvotes: 327

Views: 531217

Answers (30)

Sherveeen
Sherveeen

Reputation: 81

First, type:

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!

Upvotes: 1

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59557

If you like to disable proxy settings just temporarily, then run

npm --noproxy "registry.npmjs.org" install <package>

Upvotes: 0

Ali Nasir
Ali Nasir

Reputation: 1

You can delete the proxy and https-proxy manually from the .npmrc file

Upvotes: 0

Leon1246
Leon1246

Reputation: 23

this will clean-up proxies from both local and global configs without --global it will clear only from the current user profile:

npm config rm proxy npm config rm https-proxy npm config --global rm proxy npm config --global rm https-proxy

Upvotes: 0

Cheung Riche
Cheung Riche

Reputation: 81

Here is my solution: Step 1:

env |grep proxy e.g,I got: http_proxy https_proxy

Step2: unset the proxy variables

unset http_proxy unset https_proxy

Then npm install works ok now

Upvotes: 0

Shehara Jayashan
Shehara Jayashan

Reputation: 111

Try This,

npm config delete http-proxy

npm config delete https-proxy

npm config rm proxy

npm config rm https-proxy

set HTTP_PROXY=null

set HTTPS_PROXY=null

Upvotes: 11

Lautaro Mascitti
Lautaro Mascitti

Reputation: 337

In my case, (windows OS), after put all those commands listed, npm kept taking the proxy in the setting of windows registry

\ HKEY_CURRENT_USER \ Environment

just remove the proxy settings there, after that, I restarted the pc and then "npm install" worked for me

Example

Upvotes: 1

Anand
Anand

Reputation: 51

If you want to switch between proxy for company network and remove proxy for home/personal network you can use --no-proxy

Sample usage:

npm install --save-dev "@angular/[email protected]" --no-proxy

Upvotes: 3

Oguz Ozcan
Oguz Ozcan

Reputation: 1547

In the latest version npm rm proxy does not work. Instead use npm rm http-proxy

npm config rm proxy npm config rm https-proxy

Upvotes: 31

Nicolas Meinen
Nicolas Meinen

Reputation: 63

Well, I'm gonna leave this here because I was having a big trouble with NPM.

I was trying to change a proxy setting using npm config set proxy "http://.../" and then running npm config get proxy. It was ALWAYS returning a wrong value, different from the one that I'd set.

I found out that I had a .npmrc COMMITED on the project I was trying to run npm install and that this file was overriding my own config.

So it was cleaning the proxy value, but I needed to also change the .npmrc inside the folder's project.

After that, everything worked fine.

Upvotes: 2

Santy
Santy

Reputation: 1

Http Module is deprecated and it is replaced with HttpClient.

Change your imports to import { HttpClientModule } from '@angular/common/http';

Upvotes: 0

Erik James Robles
Erik James Robles

Reputation: 899

I was struggling with this for ages. What I finally did was go into the .npmrc file (which can be found in the user's directory followed by the user's name, ie. C:\Users\erikj/.npmrc), opened it with a text editor, manually removed any proxy settings and changed the http:// setting to https://. In this case, it is a matter of experimenting whether http or https will work for you. In my case, https worked. Go figure.

Upvotes: 1

Ankur Dhawan
Ankur Dhawan

Reputation: 21

execute npm config list it will list down all proxy values.. in my case proxy value was fetched form global npmrc file, removed it and was able to complete npm install on my windows machine

Upvotes: 2

Shagun Pruthi
Shagun Pruthi

Reputation: 2051

I have used the below commands for removing any proxy set:

    npm config rm proxy
    npm config rm https-proxy

And it solved my problem :)

Upvotes: 22

Arvind
Arvind

Reputation: 171

I had the same problem once.
Follow these steps to delete proxy values:

1.To delete proxy in npm:
(-g is Important)
npm config delete proxy -g
npm config delete http-proxy -g
npm config delete https-proxy -g

Check the npm config file using:
npm config list

2.To delete system proxy: set HTTP_PROXY=null set HTTPS_PROXY=null

Now close the command line and open it to refresh the variables(proxy).

Upvotes: 17

hannad rehman
hannad rehman

Reputation: 4341

there is a simple way of deleting or removing the npm proxies.

npm config delete proxy
npm config delete https-proxy

Upvotes: 17

Anatolii Gabuza
Anatolii Gabuza

Reputation: 6260

This was already answered but I think the --global config is not covered properly.

By running npm config rm proxy you remove proxy from user configuration.
This can be easily verified by running: npm config list.

If there is proxy or https-proxy setting set in global config you have to use --global in the command to remove it.

So at the end this will clean-up proxies from both local and global configs:

npm config rm proxy
npm config rm https-proxy
npm config --global rm proxy
npm config --global rm https-proxy

Upvotes: 44

velu
velu

Reputation: 161

Nothing above worked for me. I had to edit the file ".npmrc" which will be under user home directory (ex: c:\users\abcuser) :

http_proxy=null
registry=https://registry.npmjs.org/
strict-ssl=true
proxy=null

Upvotes: 15

Seun S. Lawal
Seun S. Lawal

Reputation: 601

The easiest way to remove any configuration at all from npm is to edit the npm config file. It only takes two(2) commands to do this; one to open npm config file for editing, the other to confirm your change.

  1. type npm config list to view a list of all npm configurations that are active.
  2. type npm config edit to open a text editor with npm configurations. To remove the proxy line ( or simply comment it out ).
  3. Save the config file and close it.
  4. type npm config list to confirm that the proxy configuration has been removed.

C'est la vie!

I tried everything listed on this page, none worked, then I tried to the config edit. It worked instantly. (I use Windows 10)

Upvotes: 10

Ravinath
Ravinath

Reputation: 1760

this works for me fime

proxy=http://<username>:<pass>@proxyhost:<port>

https-proxy=http://<uname>:<pass>@proxyhost:<port>

sample in my instance username:uname and password:pword

npm config set proxy=http://uname:[email protected]:8080

npm config set https-proxy=http://uname:[email protected]:8080

Upvotes: 1

venergiac
venergiac

Reputation: 7727

npm config delete http-proxy
npm config delete https-proxy

npm config delete proxy -g
npm config delete http-proxy -g

then

npm config get proxy

null

also

npm i -g bower to update

npm had a bug on the proxy

Upvotes: 3

venkat7668
venkat7668

Reputation: 2777

This works

npm config delete http-proxy
npm config delete https-proxy

npm config rm proxy
npm config rm https-proxy

set HTTP_PROXY=null
set HTTPS_PROXY=null

Upvotes: 14

Dirceu Henrique
Dirceu Henrique

Reputation: 49

I've used

npm config set proxy null
npm config set https-proxy null

and it worked for me.

Best regards

Upvotes: 1

Aaron
Aaron

Reputation: 2236

Try deleting them with:

npm config delete proxy
npm config delete https-proxy

Upvotes: 158

Hari Gillala
Hari Gillala

Reputation: 11926

See the npm Settings in file C:\Users\myusers.npmrc file. Sometime the npm proxy config settings does not apply. so its worth checking in there.

Upvotes: 3

James-Jesse Drinkard
James-Jesse Drinkard

Reputation: 15723

Running npm version 2.10.1 in windows 7, I used:

npm config delete proxy
npm config delete https-proxy

Upvotes: 13

Amit Teli
Amit Teli

Reputation: 935

npm config delete proxy -g

worked for me.

-g was important as initially it was set with that option. You can check configurations set with :

npm config list

Upvotes: 8

rappo
rappo

Reputation: 1

ok, "NPM config delete ..." is the right command for Windows environment, viceversa "NPM config rm ..." it is for Unix-like environment. Moreover, at least for me, it was mandatory to add the option "-g" because the command worked properly

Upvotes: -1

moukhan
moukhan

Reputation: 69

npm config rm proxy
npm config rm https-proxy

Worked for me

Upvotes: 6

Shamseer
Shamseer

Reputation: 692

You will get the proxy host and port from your server administrator or support.

After that set up

npm config set http_proxy http://username:[email protected]:itsport npm config set proxy http://username:[email protected]:itsport If there any special character in password try with % urlencode. Eg:- pound(hash) shuold be replaced by %23.

This worked for me...

Upvotes: -1

Related Questions