Error 'tunneling socket' while executing npm install
NpmProtractorNpm Problem Overview
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?
Npm Solutions
Solution 1 - Npm
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:
-
For SSL/https proxies, the protocol in URL should be http not https
-
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.
-
If there is no proxy , remove proxy config from npm
>npm config set proxy null >npm config set https-proxy null
Solution 2 - Npm
I know this is way too late but if someone has a similar issue in the future and you are sure you have no proxy set
but you have an environment variable called http_proxy. Please delete it and try again. I had set a proxy for Fiddler.
Solution 3 - Npm
according to this it's proxy isssues, try to disable ssl and set registry to http instead of https . hope it helps!
npm config set registry=http://registry.npmjs.org/
npm config set strict-ssl false
Solution 4 - Npm
Following commands may solve your issue:
npm config set proxy false
npm cache clean
It solved my same issue.
Solution 5 - Npm
Removing the proxy settings resolved the issue:
If you are no using any proxy:
npm config rm proxy
npm config rm https-proxy
If you are using Proxy:
npm config set proxy http://proxyhostname:proxyport
npm config set https-proxy https://proxyhostname:proxyport
Hopefully this will solve your problem :)
Solution 6 - Npm
In my case helped delete .npmrc config file
rm ~/.npmrc
Solution 7 - Npm
remember to set you username and password if required:
http://USERNAME:[email protected]:8080
Example:
npm config set proxy http://USERNAME:[email protected]:8080
Solution 8 - Npm
If in case you are using ubuntu trusty 14.0 then search for Network and select Network Proxy and make it none. Now proxy may still be set in system environment variables. check
env|grep -i proxy
you may get output as
http_proxy=http://192.168.X.X:8080/
ftp_proxy=ftp://192.168.X.X:8080/
socks_proxy=socks://192.168.X.X:8080/
https_proxy=https://192.168.X.X:8080/
unset these environment variable as:
unset(http_proxy)
and in this way unset all. Now run npm install ensuring user must have permission to make node_modules folder where you are installing module.
Solution 9 - Npm
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 file ~.bashrc
which also contained a wrong 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
Solution 10 - Npm
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.
Solution 11 - Npm
I lost a day trying to make this work. Worked with this steps.
I opened Fiddler and checked the option Rules > Automatically Autenticate.
After, search for file .npmrc, usually in c:\users<username> and used it as configuration:
registry=https://registry.npmjs.org/
proxy=http://username:password@127.0.0.1:8888
https-proxy=http://username:password@127.0.0.1:8888
http-proxy=http://username:password@127.0.0.1:8888
strict-ssl=false
ca=null
Hope help someone!
Solution 12 - Npm
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.
Solution 13 - Npm
I had this same error when trying to install Cypress via npm. I tried many of the above solutions as I am behind a proxy, but was still seeing the same error. In the end I found that my WIndows system configuration(can be checked by entering 'set' in command prompt) had HTTP and HTTPS proxys set that differed from the ones vonfigure in npm. I deleted these proxys and it downloaded staright away.
Solution 14 - Npm
I have faced similar issue and none of the above solution worked as I was in protected network.
To overcome this, I have installed "Fiddler" tool from Telerik, after installation start Fiddler and start installation of Protractor again.
Hope this will resolve your issue.
Thanks.
Solution 15 - Npm
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
Solution 16 - Npm
After looking at all of the answers, the one that helped me was providing proxy values in-line with the install command. One of my frustrations was adding the domain to my username. This is not needed. I used the following example to install a specific version of Angular:
npm install -g @angular/cli@1.7.3 --proxy "http://username:password@proxy_server:proxy_port" --registry http://registry.npmjs.org
Solution 17 - Npm
I spent days trying all the above answers and ensuring I had the proxy and other settings in my node config correct. All were and it was still failing. I was/am using a Windows 10 machine and behind a corp proxy.
For some legacy reason, I had HTTP_PROXY
and HTTPS_PROXY
set in my user environment variables which overrides the node ones (unknown to me), so correcting these (the HTTPS_PROXY
one was set to https, so I changed to HTTP) fixed the problem for me.
This is the problem when we can have the Same variables in Multiple places, you don't know what one is being used!
Solution 18 - Npm
npm config set registry http://registry.npmjs.org/
above code solved my issue :)
Solution 19 - Npm
I faced similar and tried some of the techniques mentioned here. To overcome,
> I performed a cleanup of duplicate entries in c:\users\<user name>\.npmrc
Hope it helps someone. Thanks,
Solution 20 - Npm
If you are using a VPN on a secure network (like a VPN for working-from-home), you may have an issue with permissions. For me, I solved this using sudo
to initialize a ReactJS development environment...
sudo npm install
Solution 21 - Npm
If you're trying all of the above and still having issues, make sure your local path does not contain spaces. (There are ways to allow spaces but mine wasn't set up that way.) In my case, I was using MAMP with a Server Document root of /Users/myusername/My Site
. Changing this to /Users/myusername/My-Site
resolved the issue.
Solution 22 - Npm
For windows
If you are not using any proxy (search proxy in start menu search bar to see settings) then
>npm config set proxy null
>npm config set https-proxy null
>npm cache clean
If above does not work, you might need to do it by force, but only if you are sure cache clean does not cause any other installation problem for you
>npm cache clean --force
delete http_proxy from environment variables
Try now and it should be fine