Open davebryson opened 7 years ago
I am facing the same problem. My errors are as follows : events.js:154 throw er; // Unhandled 'error' event ^
Error: connect ECONNREFUSED 151.101.112.133:443 at Object.exports._errnoException (util.js:893:11) at exports._exceptionWithHostPort (util.js:916:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1075:14)
Any suggestions are appreciated.
I was also facing a similar issue (ETIMEDOUT instead of ECONNREFUSED) and I/P was 151.101.48.133 and found a workaround.
Modified the cli.bundled.js: replaced https.request with request (refer [https://github.com/request/request])
Code Diff:
diff --git a/build/cli.bundled.js b/build/cli.bundled.js index 01c69e3..aa2605c 100755 --- a/build/cli.bundled.js +++ b/build/cli.bundled.js @@ -202412,12 +202412,8 @@ var Init = { // will fail spectacularly in a way we can't catch, so we have to do it ourselves. return new Promise(function(accept, reject) { - var options = { - method: 'HEAD', - host: 'raw.githubusercontent.com', - path: '/trufflesuite/' + expected_full_name + "/master/truffle.js" - }; - req = https.request(options, function(r) { + var request = require('request'); + request({ method: 'HEAD', uri: 'https://raw.githubusercontent.com/trufflesuite/'+expected_full_name+'/master/truffle.js'}, function (error, r, body) { if (r.statusCode == 404) { return reject(new Error("Example '" + name + "' doesn't exist. If you believe this is an error, please contact Truffle support.")); } else if (r.statusCode != 200) { @@ -202425,7 +202421,6 @@ var Init = { } accept(); }); - req.end(); }); }).then(function() { @@ -212634,4 +212629,4 @@ module.exports = require("solc"); module.exports = require("string_decoder"); /***/ }) -/******/ ]); \ No newline at end of file +/******/ ]);
Prerequisite: Install request via npm npm install -g request
Proxy - setup enviroment as described at [https://github.com/request/request#proxies] The following environment variables are respected by request:
HTTP_PROXY / http_proxy HTTPS_PROXY / https_proxy NO_PROXY / no_proxy
Hopefully this will work for you guys too.
Cheers, Bhaskar
Thanks Bhaskar, truffle init works fine after the change you suggested. I am yet to test the rest of the functionality after the change though
TODO: Review for application to Truffle Boxes.
@SinghalB I tried above thing. Post changes in cli.bundled.js, i started to get below error.
if (r.statusCode == 404) {
^
TypeError: Cannot read property 'statusCode' of undefined
at Request._callback (C:\Users\manish_bansal01\AppData\Roaming\npm\node_modu
les\truffle\build\cli.bundled.js:214192:16)
at self.callback (C:\Users\manish_bansal01\AppData\Roaming\npm\node_modules\
request\request.js:186:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestError (C:\Users\manish_bansal01\AppData\Roaming\npm\node
_modules\request\request.js:878:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at TLSSocket.socketErrorListener (_http_client.js:309:9)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at connectErrorNT (net.js:1021:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
Did i miss anything? Below is my before and after code.
Before:
var options = {
method: 'HEAD',
host: 'raw.githubusercontent.com',
path: '/trufflesuite/' + expected_full_name + "/master/truffle.js"
};
req = https.request(options, function(r) {
if (r.statusCode == 404) {
return reject(new Error("Example '" + name + "' doesn't exist. If you believe this is an error, please contact Truffle support."));
} else if (r.statusCode != 200) {
return reject(new Error("Error connecting to github.com. Please check your internet connection and try again."));
}
accept();
});
req.end();
After
/*var options = {
method: 'HEAD',
host: 'raw.githubusercontent.com',
path: '/trufflesuite/' + expected_full_name + "/master/truffle.js"
};
req = https.request(options, function(r) {*/
var request = require('request');
request({ method: 'HEAD', uri: 'https://raw.githubusercontent.com/trufflesuite/'+expected_full_name+'/master/truffle.js'}, function (error, r, body) {
if (r.statusCode == 404) {
return reject(new Error("Example '" + name + "' doesn't exist. If you believe this is an error, please contact Truffle support."));
} else if (r.statusCode != 200) {
return reject(new Error("Error connecting to github.com. Please check your internet connection and try again."));
}
accept();
});
//req.end();
@manishbansal8843 Thanks a lot for pointing the issue with the fix. I was able to reproduce this by unsetting http_proxy/https_proxy. Just check if you have the proxies set correctly or not.
Basically, on failure, the response is not coming, hence r.statusCode is undefined. I am pasting the modified code below, which handles the case and prints an error message:
var request = require('request'); request({ method: 'HEAD', uri: 'https://raw.githubusercontent.com/trufflesuite/'+expected_full_name+'/master/truffle.js'}, function (error, r, body) { if (error) { if (r && r.statusCode == 404) { return reject(new Error("Example '" + name + "' doesn't exist. If you believe this is an error, please contact Truffle support.")); } else if (r && r.statusCode != 200) { return reject(new Error("Error connecting to github.com. Please check your internet connection and try again.")); } return reject(new Error("Error connecting to github.com. Please check your internet connection and try again.")); } accept(); });
@SinghalB Ya i am suspecting it is because of my proxy settings only as i am sitting behind my organization firewall. I am working on that. Will correct above code also and update if I face any other issue. Thanks.
Thanks for bringing this to our attention everyone as a long-outstanding issue!
This has been fixed with the truffle unbox
command, and truffle init
now uses that logic for creating a bare box. This repo/package are no longer in use as of Truffle v4.0.0.
Using Truffle version 4.0.1
I still have issues with this. Both truffle unbox
and truffle init
throw the following error:
Error: Error making request. Please check the format of the requested resource:
https://raw.githubusercontent.com/truffle-box/metacoin-box/master/truffle.js
at Request._callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:311386:23)
at self.callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:283165:22)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at Request.onRequestError (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:283857:8)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
Same, both truffle init
and truffle unbox
give me:
Error: Error making request. Please check the format of the requested resource: https://raw.githubusercontent.com/truffle-box/bare-box/master/truffle.js
at Request._callback (/Users/mako/.nvm/versions/node/v8.9.1/lib/node_modules/truffle/build/cli.bundled.js:311386:23)
at self.callback (/Users/mako/.nvm/versions/node/v8.9.1/lib/node_modules/truffle/build/cli.bundled.js:283165:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/Users/mako/.nvm/versions/node/v8.9.1/lib/node_modules/truffle/build/cli.bundled.js:283857:8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at ClientRequest.onError (/Users/mako/.nvm/versions/node/v8.9.1/lib/node_modules/truffle/build/cli.bundled.js:327212:21)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
Truffle v4.0.1 (core: 4.0.1)
I have updated truffle to 4.0.1. Even i am also facing issue as mentioned by yoryos and davebryson. Somebody please help.
I get the same error. Truffle v4.0.3, macOS 10.12.6, npm v5.5.1, node v8.9.3
truffle init Downloading... Error: Error making request. Please check the format of the requested resource: https://raw.githubusercontent.com/truffle-box/bare-box/master/truffle.js at Request._callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:314206:23) at self.callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:285576:22) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at Request.onRequestError (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:286268:8) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at TLSSocket.socketErrorListener (_http_client.js:387:9) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7)
Same problem on truffle 4.0.5. Anyone help?
Truffle v4.1.0 - a development framework for Ethereum
➜ workspace truffle init Downloading... Error: Error making request to https://raw.githubusercontent.com/truffle-box/bare-box/master/truffle.js. Got error: tunneling socket could not be established, cause=write EPROTO 139725019055936:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827: . Please check the format of the requested resource. at Request._callback (/usr/local/src/node-v8.9.4/lib/node_modules/truffle/build/webpack:/~/truffle-box/lib/utils/unbox.js:45:1) at self.callback (/usr/local/src/node-v8.9.4/lib/node_modules/truffle/build/webpack:/~/truffle-box/~/request/request.js:186:1) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at Request.onRequestError (/usr/local/src/node-v8.9.4/lib/node_modules/truffle/build/webpack:/~/truffle-box/~/request/request.js:878:1) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at ClientRequest.onError (/usr/local/src/node-v8.9.4/lib/node_modules/truffle/build/webpack:/~/tunnel-agent/index.js:179:1) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:116:13)
Hey Everyone,
I just got this error Error: Error making request to https://raw.githubusercontent.com/trufflesuite/truffle-init-default/master/truffle.js. Got error: connect ECONNREFUSED 151.101.152.133:443. Please check the format of the requested resource. at Request._callback (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-box/lib/utils/unbox.js:45:1) at self.callback (/usr/lib/node_modules/truffle/build/webpack:/~/request/request.js:185:1) at Request.emit (events.js:182:13) at Request.onRequestError (/usr/lib/node_modules/truffle/build/webpack:/~/request/request.js:877:1) at ClientRequest.emit (events.js:182:13) at TLSSocket.socketErrorListener (_http_client.js:391:9) at TLSSocket.emit (events.js:182:13) at emitErrorNT (internal/streams/destroy.js:82:8) at emitErrorAndCloseNT (internal/streams/destroy.js:50:3) at process._tickCallback (internal/process/next_tick.js:63:19).
But Got it solved by just updating my ubuntu machine. Try using the command sudo apt-get update
I had the same problem as OP but could solve it with the workaround of @SinghalB. Thanks a ton for that.
Best, Tobi
I have a Error: Error connecting to github.com. Please check your internet connection and try again.
error.
macOS 11.3 Truffle v5.3.12 (core: 5.3.12) Solidity v0.5.16 (solc-js) Node v14.17.1 Web3.js v1.3.6
HTTP_PROXY and Node proxy config are both set.
Using Truffle 3.1.2
Node is setup with proxy settings and works correctly.
Running
truffle init
results in:Error: connect ECONNREFUSED
with a given IP.This may be due to the
rejectUnauthorized
(default is true) setting in nodes HTTPS lib.https://nodejs.org/api/https.html for proxies that mess with SSL certs.