relay icon indicating copy to clipboard operation
relay copied to clipboard

TodoMVC example start failed

Open chentsulin opened this issue 10 years ago • 17 comments

It seems cause by babel v5 which included by fbjs-scripts (react-native 0.26 -> fbjs-scripts 0.4 -> babel 5.x). I also wonder why babel-node is executed from babel v5 and not babel-cli v6..

Stacktrace:

> [email protected] start /Users/chentsulin/Projects/relay/examples/TodoMVC
> BABEL_ENV=server babel-node ./server.js

/Users/chentsulin/Projects/relay/examples/TodoMVC/node_modules/babel/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126
      if (!option) this.log.error("Unknown option: " + alias + "." + key, ReferenceError);
                           ^

TypeError: Cannot read property 'error' of undefined
    at OptionManager.mergeOptions (/Users/chentsulin/Projects/relay/examples/TodoMVC/node_modules/babel/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:28)
    at OptionManager.init (/Users/chentsulin/Projects/relay/examples/TodoMVC/node_modules/babel/node_modules/babel-core/lib/transformation/file/options/option-manager.js:235:12)
    at compile (/Users/chentsulin/Projects/relay/examples/TodoMVC/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:117:22)
    at normalLoader (/Users/chentsulin/Projects/relay/examples/TodoMVC/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:14)

chentsulin avatar May 29 '16 12:05 chentsulin

Fix on its way in #1183.

steveluscher avatar May 31 '16 17:05 steveluscher

I also wonder why babel-node is executed from babel v5 and not babel-cli v6..

I suspect that's because fbjs-scripts from react-native is pulling in a whole set of Babel 5 deps. Exploring this in https://github.com/facebook/react-native/pull/7855

steveluscher avatar May 31 '16 20:05 steveluscher

This should start to work when https://github.com/facebook/react-native/pull/7855 makes its way into a release.

steveluscher avatar Jun 01 '16 20:06 steveluscher

#7855 has been closed. Any update on this?

Dielz98 avatar Jun 09 '16 13:06 Dielz98

Yep! Waiting for a release of React Native so I can update this. Has it been released since my PR landed? I haven't checked.

On Jun 9, 2016, at 6:29 AM, Dielz98 [email protected] wrote:

#7855 has been closed. Any update on this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

steveluscher avatar Jun 09 '16 16:06 steveluscher

Looks like it has. I'll do the upgrade!

steveluscher avatar Jun 09 '16 16:06 steveluscher

Whoops. Spoke too soon. React Native 0.27 doesn't contain https://github.com/facebook/react-native/pull/7855.

steveluscher avatar Jun 09 '16 22:06 steveluscher

Any workarounds to get the npm start to work, until this fix is available?

bschandramohan avatar Jun 14 '16 12:06 bschandramohan

You can use NPM 2 (i.e. with Node 4) and it should work!

On Jun 14, 2016, at 8:04 AM, Chandra Mohan [email protected] wrote:

Any workarounds until this fix is available?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

steveluscher avatar Jun 14 '16 14:06 steveluscher

Any workarounds to get the npm start to work, until this fix is available?

I also tried this morning with 0.28.0-rc.0 and was successful:

diff --git a/examples/TodoMVC/package.json b/examples/TodoMVC/package.json
index 6d63522..f8bba47 100644
--- a/examples/TodoMVC/package.json
+++ b/examples/TodoMVC/package.json
@@ -13,8 +13,8 @@
     "express-graphql": "0.5.2",
     "graphql": "0.6.0",
     "graphql-relay": "0.4.2",
-    "react": "15.0.2",
-    "react-native": "0.26.2",
+    "react": "15.1.0",
+    "react-native": "0.28.0-rc.0",
     "react-native-listitem": "1.0.5",
     "react-native-swipeout": "git+https://github.com/magrinj/react-native-swipeout#403d973504b58ede25c137fb31b0eff7e03b0a66",
     "react-relay": "0.9.0"

wincent avatar Jun 21 '16 18:06 wincent

No need rc, RN-0.28 has been released. https://github.com/facebook/react-native/releases

Dielz98 avatar Jun 22 '16 12:06 Dielz98

after upgrading to RN 0.28.0 and React 15.1.0 (also node v6.0.0 and npm v3.8.6) I'm now getting:

npm ERR! Darwin 15.5.0
npm ERR! argv "/Users/barakcohen/.nvm/versions/node/v6.0.0/bin/node" "/Users/barakcohen/.nvm/versions/node/v6.0.0/bin/npm" "start"
npm ERR! node v6.0.0
npm ERR! npm  v3.8.6
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `babel-node ./server.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script 'babel-node ./server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the TodoMVC package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel-node ./server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs TodoMVC
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls TodoMVC
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/barakcohen/workspace/relay/examples/TodoMVC/npm-debug.log

barakcoh avatar Jun 22 '16 12:06 barakcoh

Error said:

Please include the following file with any support request: /Users/barakcohen/workspace/relay/examples/TodoMVC/npm-debug.log

Dielz98 avatar Jun 22 '16 23:06 Dielz98

sorry, I didn't attach it the 1st time because I couldn't find anything useful. here you go:

0 info it worked if it ends with ok
1 verbose cli [ '/Users/barakcohen/.nvm/versions/node/v6.0.0/bin/node',
1 verbose cli   '/Users/barakcohen/.nvm/versions/node/v6.0.0/bin/npm',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: /Users/barakcohen/.nvm/versions/node/v6.0.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/barakcohen/workspace/relay/examples/TodoMVC/node_modules/.bin:/Users/barakcohen/.nvm/versions/node/v6.0.0/bin:/Users/barakcohen/.rvm/gems/ruby-2.0.0-p481/bin:/Users/barakcohen/.rvm/gems/ruby-2.0.0-p481@global/bin:/Users/barakcohen/.rvm/rubies/ruby-2.0.0-p481/bin:/Users/barakcohen/.rvm/bin:/usr/local/heroku/bin:/Users/barakcohen/.nvm/versions/node/v6.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/barakcohen/workspace/PredictionIO/bin:/Users/barakcohen/google-cloud-sdk/bin:/Users/barakcohen/Library/Android/sdk/platform-tools
10 verbose lifecycle [email protected]~start: CWD: /Users/barakcohen/workspace/relay/examples/TodoMVC
11 silly lifecycle [email protected]~start: Args: [ '-c', 'babel-node ./server.js' ]
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `babel-node ./server.js`
13 verbose stack spawn ENOENT
13 verbose stack     at ChildProcess.<anonymous> (/Users/barakcohen/.nvm/versions/node/v6.0.0/lib/node_modules/npm/lib/utils/spawn.js:17:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:850:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/barakcohen/workspace/relay/examples/TodoMVC
16 error Darwin 15.5.0
17 error argv "/Users/barakcohen/.nvm/versions/node/v6.0.0/bin/node" "/Users/barakcohen/.nvm/versions/node/v6.0.0/bin/npm" "start"
18 error node v6.0.0
19 error npm  v3.8.6
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error [email protected] start: `babel-node ./server.js`
24 error spawn ENOENT
25 error Failed at the [email protected] start script 'babel-node ./server.js'.
25 error Make sure you have the latest version of node.js and npm installed.
25 error If you do, this is most likely a problem with the TodoMVC package,
25 error not with npm itself.
25 error Tell the author that this fails on your system:
25 error     babel-node ./server.js
25 error You can get information on how to open an issue for this project with:
25 error     npm bugs TodoMVC
25 error Or if that isn't available, you can get their info via:
25 error     npm owner ls TodoMVC
25 error There is likely additional logging output above.
26 verbose exit [ 1, true ]

barakcoh avatar Jun 23 '16 12:06 barakcoh

This has been fixed by upgrading to React Native 0.28 in https://github.com/relayjs/relay-examples/commit/bb0e16970622484fac2b34914a99e292b4c095a5

steveluscher avatar Jun 28 '16 00:06 steveluscher

@steveluscher is that private repo? I've got 404 page not found

Dielz98 avatar Jun 28 '16 09:06 Dielz98

Yes @Dielz98, we're just waiting for the person with the right privileges to flip the switch.

wincent avatar Jun 28 '16 13:06 wincent