How to clear https proxy setting of NPM?

2019-01-09 22:59发布

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?

标签: node.js proxy
26条回答
Anthone
2楼-- · 2019-01-09 23:49

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.

查看更多
等我变得足够好
3楼-- · 2019-01-09 23:50

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)

查看更多
我命由我不由天
4楼-- · 2019-01-09 23:51

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

查看更多
三岁会撩人
5楼-- · 2019-01-09 23:51

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.

查看更多
成全新的幸福
6楼-- · 2019-01-09 23:52

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 :)

查看更多
劫难
7楼-- · 2019-01-09 23:52

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:pword@192.168.5.8:8080

npm config set https-proxy=http://uname:pword@192.168.5.8:8080
查看更多
登录 后发表回答