workshopper / learnyoureact

Let's learn React.js and server side rendering!
MIT License
536 stars 142 forks source link

ECONNREFUSED error occured #72

Closed kohei-takata closed 8 years ago

kohei-takata commented 9 years ago

refs https://github.com/tako-black/learnyoureact/issues/22#issuecomment-153124021 Can I fix by this code? https://gist.github.com/martinheidegger/a7cf754d91f847c29965 I will try.

xanagi commented 9 years ago

I tried adding "babel": "^5.8.23" to dependencies of package.json in learnyoureact. After running npm install under node_modules/learnyoureact/, I run "learnyoureact verify program.js" and got following result.

1.  ACTUAL:    "<!DOCTYPE html>"
1.  EXPECTED:  "SyntaxError: Unexpected reserved word"

2.  ACTUAL:    "<div class=\"todoBox\">Hello, world!</div>"
2.  EXPECTED:  "<br> &nbsp; &nbsp;at exports.runInThisContext (vm.js:53:16)"

3.  ACTUAL:    ""
3.  EXPECTED:  "<br> &nbsp; &nbsp;at Module._compile (module.js:414:25)"

4.  ACTUAL:
4.  EXPECTED:  "<br> &nbsp; &nbsp;at Object.require.extensions.(anonymous function) [as .jsx] (/Users/kusanagi/.nvm/versions/node/v4.2.2/lib/node_modules/learnyoureact/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:214:7)"

5.  ACTUAL:
5.  EXPECTED:  "<br> &nbsp; &nbsp;at Module.load (module.js:356:32)"

6.  ACTUAL:
6.  EXPECTED:  "<br> &nbsp; &nbsp;at Function.Module._load (module.js:311:12)"

7.  ACTUAL:
7.  EXPECTED:  "<br> &nbsp; &nbsp;at Module.require (module.js:366:17)"

8.  ACTUAL:
8.  EXPECTED:  "<br> &nbsp; &nbsp;at require (module.js:385:17)"

9.  ACTUAL:
9.  EXPECTED:  "<br> &nbsp; &nbsp;at View.renderFile [as engine] (/Users/kusanagi/.nvm/versions/node/v4.2.2/lib/node_modules/learnyoureact/node_modules/express-react-views/index.js:43:23)"

10. ACTUAL:
10. EXPECTED:  "<br> &nbsp; &nbsp;at View.render (/Users/kusanagi/.nvm/versions/node/v4.2.2/lib/node_modules/learnyoureact/node_modules/express/lib/view.js:93:8)"

11. ACTUAL:
11. EXPECTED:  ""
peterlazar1993 commented 9 years ago

I get the same error as xanagi too.

kohei-takata commented 9 years ago

I think I can fix by changing like https://github.com/workshopper/learnyounode/commit/d583db654de953b988561a9601170ec6a4927b74 I will do tonight.

kohei-takata commented 9 years ago

@xanagi @peterlazar1993 Thank you for your comment! I changed some codes. I think it will work correctly. Could you use v0.10.0-patched and give feedback to me? If the version work correctly, I will merge to master.

scottnath commented 9 years ago

Hi @kohei-takata,

I tried your change of code here: https://github.com/kohei-takata/learnyoureact/blob/fix_timeout_bug/exercises/hello_react/exercise.js

And now the test seems to run, but I'm getting an error from the results:

$learnyoureact verify program.js
✗ ?exercises.HELLO_REACT.fail.connection || common.exercise.fail.connection?

Your submission results compared to the expected:

────────────────────────────────────────────────────────────────────────────────

1.  ACTUAL:    "<!DOCTYPE html>"
1.  EXPECTED:  ""

2.  ACTUAL:    "<div class=\"todoBox\">Hello, world!</div>"
2.  EXPECTED:

────────────────────────────────────────────────────────────────────────────────

✗ Submission results did not match expected!

# FAIL

Your solution to HELLO_REACT didn't pass.
xanagi commented 9 years ago

I got the same result as @scottnash.

kohei-takata commented 9 years ago

@scottnath @xanagi Thanks for trying. I'll try to fix again.

kohei-takata commented 9 years ago

@scottnath @xanagi How is this? https://github.com/kohei-takata/learnyoureact/blob/fix_timeout_bug/exercises/hello_react/exercise.js

scottnath commented 9 years ago

@kohei-takata

These are the results I got:

run

<!DOCTYPE html>
<div class="todoBox">Hello, world!</div>%

verify

✗ ?exercises.HELLO_REACT.fail.connection || common.exercise.fail.connection?

Your submission results compared to the expected:

────────────────────────────────────────────────────────────────────────────────

1.  ACTUAL:    "<!DOCTYPE html>"
1.  EXPECTED:  ""

────────────────────────────────────────────────────────────────────────────────

✗ Submission results did not match expected!

# FAIL

Your solution to HELLO_REACT didn't pass. Try again!

So, it seems the fail.connection says it's still failing on finding the second port.

xanagi commented 8 years ago

@kohei-takata

I got the completely same result as @scottnath.

It seems that the solution child process fails at 'require('babel/register')' in solution.js. I added the following lines to learnyoureact/node_modules/workshopper-exercise/execute.js around line 90.

this.solutionChild.stderr.on('data', function(data){
  console.log('----------');
  console.log(data.toString());
  console.log('----------');
});

The output of verify was

$ learnyoureact verify program.js
----------
module.js:339
    throw err;
    ^

Error: Cannot find module 'babel/register'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/kusanagi/.nodebrew/node/v4.2.2/lib/node_modules/learnyoureact/exercises/hello_react/solution/solution.js:9:1)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)

----------
✗ ?exercises.HELLO_REACT.fail.connection || common.exercise.fail.connection?

Your submission results compared to the expected:

────────────────────────────────────────────────────────────────────────────────

1.  ACTUAL:    "<!DOCTYPE html>"
1.  EXPECTED:  ""

2.  ACTUAL:    "<div class=\"todoBox\">Hello, world!</div>"
2.  EXPECTED:

────────────────────────────────────────────────────────────────────────────────

✗ Submission results did not match expected!

# FAIL

Your solution to HELLO_REACT didn't pass. Try again!
kohei-takata commented 8 years ago

@scottnath @xanagi This bug seems to be fixed by https://github.com/babel/babel/issues/1889. I will make a PR #75. After testing, I will merge that to master. Anyway, thanks for your testing and reporting.

scottnath commented 8 years ago

@kohei-takata confirmed fix. thank you.

kohei-takata commented 8 years ago

@scottnath I'm glad to hear that. Thank you for your report! :smile:

xanagi commented 8 years ago

@kohei-takata

I confirmed fix too. Thanks!

kohei-takata commented 8 years ago

@xanagi I'm glad to hear that! Thanks for your comment :smiley: