“babelHelpers.asyncToGenerator is not a function”

2019-07-11 06:46发布

I updated React-Native from 0.14.0 to 0.16.0 and from now, I have errors at runtime:

https://cloud.githubusercontent.com/assets/3106676/11873009/b5b3aee2-a4d8-11e5-96db-831de137af06.png

https://cloud.githubusercontent.com/assets/3106676/11873609/c1cc1c34-a4db-11e5-981f-8d7d8c653819.png

Here are the npm dependencies:

"dependencies": {
  "async": "^1.5.0",
  "immutable": "^3.7.6",
  "react-native": "^0.16.0",
  "react-native-contacts": "../../react-native-contacts",
  "react-native-contacts-rx": "^1.0.1",
  "react-native-gifted-messenger": "0.0.7",
  "react-native-i18n": "0.0.6",
  "react-redux": "^4.0.1",
  "redux": "^3.0.5",
  "rx": "^4.0.7"
},
"devDependencies": {
  "babel-eslint": "^5.0.0-beta6",
  "eslint": "^1.10.3",
  "eslint-config-airbnb": "^2.1.1",
  "eslint-plugin-react": "^3.11.3",
  "events": "^1.1.0",
  "flux": "^2.1.1",
  "keymirror": "^0.1.1",
  "lodash": "^3.10.1",
  "redux-devtools": "^3.0.0"
}

And my .babelrc file:

{
  "retainLines": true,
  "compact": true,
  "comments": false,
}

Any suggestions?

2条回答
走好不送
2楼-- · 2019-07-11 07:36

The Questions was answered in an issue @Jean Lebrument submitted. Positing answer here for stumblers like myself...

https://github.com/facebook/react-native/issues/4844

The problem is most likely in your .babelrc file. If you experience this problem, compare your .babelrc file to react natives default one. Try removing the file or building off of default one, adding the features that you need.

Make sure to restart your packager, stop, and re-run your project.

查看更多
一夜七次
3楼-- · 2019-07-11 07:44

I had this exact same problem you can check out what I did here - https://stackoverflow.com/a/53069785/2884655

But in short I just imported the babel-plugin-transform-async-to-generator module into my project and added it into my babelrc file

查看更多
登录 后发表回答