node.jsgitproxynpmsocks

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.


Solution

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