“babelHelpers.asyncToGenerator is not a function” on React-Native 0.16.0 and 0.17.0

℡╲_俬逩灬. 提交于 2019-12-23 22:58:58

问题


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

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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/34338416/babelhelpers-asynctogenerator-is-not-a-function-on-react-native-0-16-0-and-0-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!