" babelHelpers.asyncToGenerator不是一个函数"在React-Native 0.16.0和0.17.0上

时间:2015-12-17 15:36:14

标签: node.js react-native babeljs

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

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

以下是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,
}

有什么建议吗?

2 个答案:

答案 0 :(得分:1)

在@Jean Lebrument提交的问题中回答了这些问题。在这里为像我这样的笨蛋提出答案......

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

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

确保重新启动打包程序,停止并重新运行项目。

答案 1 :(得分:0)

我遇到了同样的问题,您可以查看我在这里所做的事情-https://stackoverflow.com/a/53069785/2884655

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