npm install module Error: tunneling socket error - node.js

I am not able to install nodejs modules using npm on windows. I am behind a proxy and I set the proxy like this:
npm config set proxy internet.cp:8080
npm config set proxy-http internet.cp:8080
When I try to install a packet, i get this error:
npm info retry will retry, error on last attempt: Error: tunneling socket could not be established
I have some questions:
- how can I make npm work with socks5
- can I configure a proxycap file so that npm will use socks5
- other suggestions

It may be happening due to your proxy which is preventing https requests.
Try executing the below command before installing the packets.
npm config set registry http://registry.npmjs.org/
Hope this helps!

It turned out that the proxy I used wasn't the right one. Afeter using the right proxy, and setting it with the commands above, it worked.
npm config set proxy internet.cp:8080
npm config set proxy-http internet.cp:8080

Related

npm request failed, reason: connect ETIMEDOUT 104.16.16.35:443

We are trying to get npm to work on a Windows Server 2019.
The server is configured like this:
The server runs as a guest in the ESX VMWare environment.
Server runs behind a checkpoint firewall and a ClearSwift proxy (several antivirus engines active).
An F5 load balancing reverse proxy is run internally in the MSM network via DNS.
Server is running Bitdefender AntiVirus
Server runs with Windows2019 current patch status.
Current firewall settings:
All Denied LAN> Intranet
All Denied Intranet> LAN
We always get this error, no matter what we tried:
This is what we tried so far:
npm config set registry "http://registry.npmjs.org/"
ping proxy
npm config set proxy https-proxy http://proxy.johndoe.corp:8080
npm config set https-proxy http://proxy.johndoe.corp:8080
npm config set strict-ssl false
set HTTPS_PROXY=http://proxy.johndoe.corp:8080
set HTTP_PROXY=http://proxy.johndoe.corp:8080
npm --proxy http://proxy.johndoe.corp:8080 --without-ssl --insecure -g install
npm install --global gulp#3.9.1
We always get the ETIMEDOUT error, and I wasn't able to find the correct solution on the internet.
Any help is appreciated!

How to fix ETIMEDOUT error after npm install?

This is the error I receive:
I get similar errors in other projects as well after npm install.
First make sure that the server you are trying to access is up. The address is a little sketchy. Ping should do the trick:
$ ping http://bbdr.dcc.com.de:5005
If pinging is successful, make sure that your firewall is not blocking traffic.
If you are behind a proxy, check if $ ping http://bbdr.dcc.com.de:5005 works.
And if you are not behind any proxy, then try below commands -
npm config delete proxy
npm config delete http-proxy
npm config delete https-proxy

How to setup Node.js behind a corporate proxy

I have installed node.js in my windows machine which is in a corporate network. So i will have to use my Id and password to access internet through the proxy server.
I have read that we can use npm config set proxy to set the proxy.
npm config set proxy http://ABC\\123456:password#proxy.ABC.com:6050
I have tried it and is not working.
How can i specify the proxy details including username and password in NPM??
My user name is domain\username and password has special characters '!' and '#'
First open a command console at the location of your npm installation.
Then you can configure your npm to use a proxy using the commands:
npm config set proxy http://{url}:{port}
npm config set https-proxy http://{url}:{port}
Notice the protocol is set to http for both the proxy and https-proxy variables.
If you would like npm to store your credentials for the proxy,
you can additionally modify the commands as follows:
npm config set proxy http://{username}:{passphrase}#{url}:{port}
npm config set https-proxy http://{username}:{passphrase}#{url}:{port}
For example:
npm config set proxy http://LanguidSquid:Password1#my.company.com:8080
npm config set https-proxy http://LanguidSquid:Password1#my.company.com:8080
Additional information here: Using npm behind corporate proxy .pac
It's simple:
npm config set proxy http://username:password#proxy.company.com:8080
EDIT: Sorry didn't read about special chars:
You have to encode the special characters. E.g. instead of this:
http://username:p#ssword#proxy.company.com:8080
you have to write this:
http://username:p%40ssword#proxy.company.com:8080
Open an command prompt or terminal session and run the following commands to configure npm to work with your web proxy. The commands use proxy.company.com as the address and 8080 as the port.
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

installing Ionic Framework in node js

I am getting an error when installing Ionic framework in node js. I am behind a proxy but I already set-up my node config to a proper proxy.
Here is the error message:
error network tunneling socket could not be established, cause=read
ECONNRESET error network This is most likely not a problem with npm
itself error network and is related to network connectivity. error
network In most cases you are behind a proxy or have bad network
settings. error network error network If you are behind a proxy,
please make sure that the error network 'proxy' config is set
properly. See: 'npm help confi
Try installing older version of Node(0.10.38).
Already answere here https://stackoverflow.com/a/31124491/1276616
Try to use this
1) Check if u have a proxy
npm config get proxy
2) If u have, remove them
npm config rm proxy
npm config rm https-proxy
I hope be useful.
Source: How clear proxy npm

npm Fails to Install over Socks5 Proxy

I am having trouble running npm install over a socks5 proxy.
Proxy is running locally, to tunnel http(s) over ssh to company intranet: ssh -vvv -D 5000 -N <SERVER_IP>
I have configured npm's proxy:
npm config set proxy socks5h://localhost:5000
npm config set https-proxy=socks5h://localhost:5000
I just get:
npm ERR! git clone https://<INTRANET>/repo fatal: unable to access 'https://<INTRANET>/repo/': Could not resolve host: <INTRANET>
Any ideas?
P.S.: git clone from the same git repo address works perfectly.
Ok, as of now, npm does not support socks proxy: https://github.com/npm/npm/issues/6204
I now use ProxyCap.
http://www.proxycap.com
Works great. It will manage the ssh tunnel + socks proxy and route all traffic automatically (also for npm) through it.
Proxifier works for me. Simply add a proxy and npm install ...
.com/mac/
You can use polipo to convert sock5 proxy to http proxy, and it's super convenient if you're under Linux.
You can reference this page for further detail:
Convert Socks Proxy To Http Proxy: Using Polipo
For a workaround that works on both Linux and Windows, you can use http-proxy-to-socks.
$ npm install -g http-proxy-to-socks
$ hpts -s 127.0.0.1:1080 -p 8080
Now you have you http proxy at port 8080.
Use v2rayN as client.
It will launch both socks5 and http proxy.
Then you can use its http proxy for npm proxy and socks5 for other proxy at same time.
// http for npm
npm config set http-proxy http://127.0.0.1:10809
// socks5 for git
git config --global http.proxy 'socks5://127.0.0.1:10808
v2raN UI Screen Shot

Resources