-
Notifications
You must be signed in to change notification settings - Fork 11
Truffle init fails behind proxy #1
Comments
I am facing the same problem. Error: connect ECONNREFUSED 151.101.112.133:443 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 Proxy - setup enviroment as described at [https://github.com/request/request#proxies] HTTP_PROXY / http_proxy Hopefully this will work for you guys too. Cheers, |
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.
Did i miss anything? Below is my before and after code. Before:
After
|
@manishbansal8843 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 |
Using Truffle version 4.0.1 I still have issues with this. Both
|
Same, both
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 Same problem on truffle 4.0.5. Anyone help? |
Truffle v4.1.0 - a development framework for Ethereum ➜ workspace truffle init |
Hey Everyone, I just got this error 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, |
I have a macOS 11.3 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.The text was updated successfully, but these errors were encountered: