Open alcuadrado opened 7 years ago
When I run truffle init webpack, I get the following error: events.js:160 throw er; // Unhandled 'error' event ^
Error: getaddrinfo ENOTFOUND raw.githubusercontent.com raw.githubusercontent.com:443 at errnoException (dns.js:28:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26) ~/go-ethereum/myproject$
Tried searching for events.js - not sure where it is located?
Please help
@vishharithsa events.js is part of node, you won't find it in truffle's repos.
Did you have internet connectivity when you got that error? Was your DNS working ok?
@alcuadrado yes, I do. I was able to install npm, truffle without any problems.
In the meantime, my colleague decided to clone the repository since truffle init webpack threw the above mentioned error my instance runs behind a proxy. Is that an issue?
I have exactly the same issue when I send the request to the non existent host. I expect to be able to catch an error and to continue the flow.
Currently, the only way to catch the error that I found is to use:
process.on('uncaughtException', exitHandlerCB);
The problem is that this approach forces the process termination.
Is there any way to manage the error without forcing exit?
I use pure Node.js 7.8.0
@vishharithsa Your problem may be related to your proxy. What's your output for curl -vv https://raw.githubusercontent.com/
?
@pubmikeb That's because trying to do an HTTPS request to a non-existent host is a client error, and you have to handle those like I did here: https://github.com/trufflesuite/truffle-init/pull/2/files#diff-168726dbe96b3ce427e7fedce31bb0bcR46
@alcuadrado , that worked, thank you. The problem was that I focused on response values, but not on request.
@alcuadrado , following is the output of curl: curl -vv https://raw.githubusercontent.com/
CONNECT raw.githubusercontent.com:443 HTTP/1.1 Host: raw.githubusercontent.com:443 User-Agent: curl/7.35.0 Proxy-Connection: Keep-Alive
< HTTP/1.1 200 Connection established <
GET / HTTP/1.1 User-Agent: curl/7.35.0 Host: raw.githubusercontent.com Accept: /
< HTTP/1.1 301 Moved Permanently < Location: https://github.com/ < Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline' < Strict-Transport-Security: max-age=31536000 < X-Content-Type-Options: nosniff < X-Frame-Options: deny < X-XSS-Protection: 1; mode=block < X-GitHub-Request-Id: 4DBE:2315:144CF04:15248A0:59075068 < Content-Length: 0 < Accept-Ranges: bytes < Date: Mon, 01 May 2017 16:02:19 GMT < Via: 1.1 varnish < Connection: keep-alive < X-Served-By: cache-msp9224-MSP < X-Cache: HIT < X-Cache-Hits: 6 < X-Timer: S1493654540.615630,VS0,VE0 < Vary: Authorization,Accept-Encoding < Access-Control-Allow-Origin: * < X-Fastly-Request-ID: 0235ec761b4992c936ad35986f72cb2e2093a9af < Expires: Mon, 01 May 2017 16:07:19 GMT < Source-Age: 2978 <
Node's
https.request
doesn't execute its callback when there is a client error. If this happened an exception was thrown that crashes the cli process.Steps to reproduce it:
truffle init webpack
Error: getaddrinfo ENOTFOUND raw.githubusercontent.com raw.githubusercontent.com:443 at errnoException (dns.js:28:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)