Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Packager crashes because it doesn't understand the rest spread operator. #2134

Closed
sonthonaxrk opened this issue Jul 27, 2015 · 4 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@sonthonaxrk
Copy link

The latest commit a803e32 fails to build any project.

[rollo@Rollos-iMac my_project]$ npm start

> my_project@0.0.1 start /Users/rollo/Developer/my_project
> node_modules/react-native/packager/packager.sh

/Users/rollo/Developer/my_project/node_modules/react-native/packager/react-packager/src/FileWatcher/index.js:51
function(...args){return _this.emit.apply(_this,['all'].concat(args));});});
         ^^^
SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:413:25)
    at normalLoader (/Users/rollo/Developer/my_project/node_modules/react-native/node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/rollo/Developer/my_project/node_modules/react-native/node_modules/babel-core/lib/api/register/node.js:216:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/rollo/Developer/my_project/node_modules/react-native/packager/react-packager/src/Server/index.js:14:19)
    at Module._compile (module.js:430:26)

This problem arose at this commit

1109ce3

The packager will run if I change the .babelrc file https://github.com/facebook/react-native/blob/master/packager/react-packager/.babelrc

And change es6.parameters.rest to es6.parameters

The packager then runs but, it fails to transpile any rest spread operators meaning my app crashes with a syntax error in warning.js,

SyntaxError: Unexpected token '...'. Expected a parameter pattern or a ')' in a parameter list.
@dsibiski
Copy link
Contributor

@rollokb I'm having the same issue on a fresh app. This seems to be something that is being worked on in #1753

@dsibiski
Copy link
Contributor

It seems like force updating babel-core works: evansolomon@2940387#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R50

I'm sure this will be merged into master soon.

@dsibiski
Copy link
Contributor

It seems like this is a problem with Babel and they may have fixed it in their development branch: babel/babel@57d2323

@sonthonaxrk
Copy link
Author

Thanks @dsibiski, that fixed the problem.

@ide ide closed this as completed Aug 15, 2015
@facebook facebook locked as resolved and limited conversation to collaborators Jul 22, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants