Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corporate proxy and name resolution #2054

Closed
cstffx opened this issue Feb 25, 2020 · 2 comments
Closed

Corporate proxy and name resolution #2054

cstffx opened this issue Feb 25, 2020 · 2 comments

Comments

@cstffx
Copy link

cstffx commented Feb 25, 2020

My corporate proxy only fetches resources throw domain names. This means that try to get a resource by his IP address will throw an exception. For example I'm need to install a module called bcrypt. Tracing the process I discovered that [email protected] is trying to download this file https://nodejs.org/download/release/v12.13.1/node-v12.13.1-headers.tar.gz and this results in the error:

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.5.2 found at "/usr/bin/python3"
gyp http GET https://nodejs.org/download/release/v12.13.1/node-v12.13.1-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: connect EHOSTUNREACH 104.20.23.46:443
gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14)

I have the theory that node-gyp is resolving the name and doing the request with the IP address instead the name. Can be this true? In this case exists any way to change this behavior?

@cstffx cstffx changed the title proxy and name resolution Corporate proxy and name resolution Feb 25, 2020
@rvagg
Copy link
Member

rvagg commented Feb 26, 2020

EHOSTUNREACH 104.20.23.46:443 looks to me like it's not even trying to use your corporate proxy. Do you have one of the HTTP_PROXY environment variables set in your terminal so it knows what proxy to talk to? Without that it'll just blindly try and connect direct.

See https://github.com/nodejs/node-gyp/blob/master/lib/proxy.js#L70-L84 for some of the rules for detecting proxy. Use the environment variables HTTPS_PROXY, HTTP_PROXY or run npm config set proxy http..... to get this done.

@pansila
Copy link

pansila commented Mar 28, 2022

See #1154 to manually fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants