Truffle init throw er Unhandled error event

0 votes

I am new to smart contract programming, recently installed truffle using npm on Node(version: 6.10.3) When I run the command truffle init first time, I received this error:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: connect ETIMEDOUT 151.101.8.133:443
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)

The next time I run truffle init, I got ths error:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at exports._errnoException (util.js:1018:11)
    at TLSWrap.onread (net.js:568:26)

Any idea on how to resolve this?

Sep 27, 2018 in Blockchain by slayer
• 29,370 points
2,497 views

1 answer to this question.

0 votes

Modified the cli.bundled.js: replaced https.request with request

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:

  1. Install request via npm (npm install -g request)
  2. Proxy - setup enviroment as described here
answered Sep 27, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

Truffle init: Error: Cannot find module 'original-require'

I think you need to run this ...READ MORE

answered Oct 24, 2018 in Blockchain by Omkar
• 69,220 points
1,943 views
+3 votes
1 answer

When I ran truffle init, I got this error:

Hey there @Davidala! The error says that it ...READ MORE

answered Oct 29, 2018 in Blockchain by Omkar
• 69,220 points
796 views
+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,370 points
12,008 views
0 votes
1 answer

Truffle tutorials "Error:recipient address is not a contract address"

It appears like you have already migrated ...READ MORE

answered Aug 8, 2018 in Blockchain by slayer
• 29,370 points
1,153 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,942 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,468 views
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 69,220 points
1,482 views
0 votes
2 answers

Truffle migrate gives “ Error: No network specified. ”

You have to mention on which network ...READ MORE

answered Aug 13, 2018 in Blockchain by Omkar
• 69,220 points
1,741 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP