"babelHelpers.asyncToGenerator is not a function" 在 React-Native 0.16.0 和 0.17.0 上

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

我将 React-Native 从 0.14.0 更新到 0.16.0,从现在开始,我在运行时出现错误:

这里是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"
}

还有我的 .babelrc 文件:

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

有什么建议吗?

问题已在@Jean Lebrument 提交的问题中得到解答。在这里为像我这样的绊脚石提供答案......

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

问题很可能出在您的 .babelrc 文件中。如果您遇到此问题,请将您的 .babelrc 文件与 react natives default one 进行比较。尝试删除文件或构建默认文件,添加您需要的功能。

确保重新启动您的打包程序,停止并re-run您的项目。

我遇到了完全相同的问题,你可以看看我在这里做了什么 -

但简而言之,我只是将 babel-plugin-transform-async-to-generator 模块导入到我的项目中,并将其添加到我的 babelrc 文件中