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

babelHelpers.asyncToGenerator is not a function #271

Closed
niftylettuce opened this issue Mar 31, 2016 · 6 comments
Closed

babelHelpers.asyncToGenerator is not a function #271

niftylettuce opened this issue Mar 31, 2016 · 6 comments

Comments

@niftylettuce
Copy link

Hey — I'm on RN v0.21.0 using Code Push v1.10.0-beta, and as soon as I add the line import codePush from 'react-native-code-push'; into my project, I receive the error babelHelpers.asyncToGenerator is not a function. I found this issue which makes me think @brentvatne might know the solution per facebook/react-native#4844. The contents of my .babelrc are as follows:

{
  "presets": [ "react-native", "stage-0" ],
  "plugins": [
    "transform-decorators-legacy",
    "transform-async-to-generator"
  ]
}
@niftylettuce
Copy link
Author

screen shot 2016-03-31 at 11 12 03 am

@lostintangent
Copy link
Member

@niftylettuce This isn't a bug with CodePush, but rather, an issue with the packager when you use a custom Babelrc file. CodePush uses async/await and unfortunately this ends up causing issues, as you've seen with the linked bug. You would hit this issue if using any other library that uses async/await. The only solution that we've found it to either remove your custom babelrc or update the packager's Babel helpers file as mentioned in the RN bug you mentioned.

@niftylettuce
Copy link
Author

I resolved, here was my new .babelrc file:

{
  "presets": [ "react-native" ],
  "plugins": [
    "transform-decorators-legacy",
    "transform-do-expressions",
    "transform-function-bind",
    "transform-class-constructor-call",
    "transform-export-extensions",
    "syntax-trailing-function-commas",
    "transform-exponentiation-operator"
  ]
}

I also ran the packager with --reset-cache to work: node_modules/react-native/packager/packager.sh --reset-cache.

Thank you and also thanks to @skevy for help over Slack in ExponentJS.

@skevy
Copy link

skevy commented Mar 31, 2016

For further information, see here: facebook/react-native#4844 (comment)

@dayudodo
Copy link

dayudodo commented Apr 6, 2017

I found maybe is the watchman problem, I use the react 0.41.2, it occured this issue, because I install the stage-0, error, so uninstall it, but still. finally, I delete all the project and git clone again, error still their! but same project is good at my PC! so, watchman watch-del-all, rebuild, everything OK!
ultimate solution

brew uninstall watchman

@htxiong
Copy link

htxiong commented Jul 5, 2017

@niftylettuce thanks, your solution works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants