Error 'tunneling socket' while executing n

2019-01-13 07:44发布

I'm getting the error shown below while trying to execute 'npm install' command.

Error: tunneling socket could not be established, cause=connect ECONNREFUSED 10.232.207.137:8080

What do I miss?

screenshot

16条回答
倾城 Initia
2楼-- · 2019-01-13 08:18

An important point to remember is if you're behind a corporate firewall and you get you're corporate proxy settings from a .pac file, then be sure to use the value for global proxy.

查看更多
再贱就再见
3楼-- · 2019-01-13 08:23

If you are behind a proxy, set it correctly in npm.

>npm config set proxy http://proxyhost:proxyport
>npm config set https-proxy http://proxyhost:proxyport

Notes:

  1. For SSL/https proxies, the protocol in URL should be http not https

  2. If your set up is on a Docker/Vagrant instance or a hosted VM, use IP address instead of hostname for proxy as the later might not be resolvable.

  3. If there is no proxy , remove proxy config from npm

    >npm config set proxy null
    >npm config set https-proxy null
    
查看更多
对你真心纯属浪费
4楼-- · 2019-01-13 08:23

remember to set you username and password if required:

http://USERNAME:passwd@proxyserver.co.uk:8080

Example:

npm config set proxy http://USERNAME:passwd@proxyserver.co.uk:8080
查看更多
倾城 Initia
5楼-- · 2019-01-13 08:23

Next to what has described @Roshith in his answer here:

If you are behind a proxy, set it correctly in npm.

npm config set proxy http://proxyhost:proxyport
npm config set https-proxy http://proxyhost:proxyport

I had to change also the the file ~.bashrc which also contained a worng proxy setting in my case. I changed those settings here:

export HTTP_PROXY="http://proxyhost:proxyport"
export HTTPS_PROXY="http://proxyhost:proxyport"

Use the following command to verify the proxy settings:

env | grep -i proxy
查看更多
趁早两清
6楼-- · 2019-01-13 08:24

If you using gnome, and turned off the proxy at the network level, you also need to make sure you don't have proxy enabled in your terminal

➜ gconftool-2 -a /system/http_proxy  
 host = http://localhost/
 port = 2000
 use_http_proxy = false
 use_authentication = false
 authentication_password = 
 authentication_user = 
 ignore_hosts = [localhost,127.0.0.0/8]

You can drop it with

gconftool-2 -t string -s /system/http_proxy/host ""
gconftool-2 -u /system/http_proxy/port
gconftool-2 -u /system/http_proxy/host
unset http_proxy
查看更多
放我归山
7楼-- · 2019-01-13 08:28

I also ran into the similar issue and was using CNTLM for proxy configuration. In my case HTTP_PROXY and HTTPS_PROXY are taking higher precedence over http_proxy and https_proxy so be aware of changing all proxy variables.

env|grep -i proxy

and make sure all of the below proxy variables should point to the same proxy.

HTTP-PROXY = "http://localhost:3128"
HTTPS-PROXY = "https://localhost:3128"
HTTPS_PROXY = "http://localhost:3128"
HTTP_PROXY = "http://localhost:3128"
PROXY = "http://localhost:3128"
http-proxy = "http://localhost:3128"
http_proxy = "http://localhost:3128"
https-proxy = "https://localhost:3128/"
https_proxy = "https://localhost:3128"
proxy = "http://localhost:3128/"

I know some variables are unneccessary but I'm not sure which is using what.

查看更多
登录 后发表回答