2
votes

I tried various npm config but all failed:

registry=http://registry.npmjs.org/
proxy=http://host:8080/
https-proxy=http://host:8080/
strict-ssl=false

This failed with 418 I'm a teapot error.

registry=https://registry.npmjs.org/
proxy=http://host:8080/
https-proxy=http://host:8080/
strict-ssl=false

This just failed to connect.(ECONNRESET)

registry=https://registry.npmjs.org/
proxy=http://host:8080/
https-proxy=https://host:8080/
strict-ssl=false

Finally this failed with:

write EPROTO 140588447455040:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:

How should I set config to install packages through proxy server?

npm version : 6.4.1

OS : ubuntu 18.0.4

1

1 Answers

1
votes

I ran into the same issue trying to install gulp.

There is something weird about proxy configuration in npm. It appears that old versions of the proxy & https-proxy settings persist somehow, even if they're not in the config. For me, an old proxy setting, with a previous, expired, password was still present, even after I tried deleting via "npm config delete proxy".

What worked for me was to use

npm config edit

then add in valid entries for proxy and https-proxy. e.g.

proxy=http://[username]:[password]@[proxyhost]:8080/
https-proxy=http://[username]:[password]@[proxyhost]:8080/

It seemed that the https-proxy line was the one that got it working.