【问题标题】:"babelHelpers.asyncToGenerator is not a function" on React-Native 0.16.0 and 0.17.0React-Native 0.16.0 和 0.17.0 上的“babelHelpers.asyncToGenerator 不是函数”
【发布时间】:2015-12-17 15:36:13
【问题描述】:

我将 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,
}

有什么建议吗?

【问题讨论】:

标签: node.js react-native babeljs


【解决方案1】:

在@Jean Lebrument 提交的问题中回答了这些问题。在这里为像我这样的绊脚石提供答案......

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

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

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

【讨论】:

  • 链接已失效
【解决方案2】:

我遇到了同样的问题,你可以看看我在这里做了什么 - https://stackoverflow.com/a/53069785/2884655

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多