运行./gradlew assemble时发生Babel错误

时间:2018-07-12 18:13:45

标签: android reactjs react-native gradle

运行./gradlew assembleRelease后收到此错误:

    Plugin/Preset files are not allowed to export objects, only functions.
 In C:\..\node_modules\babel-preset-expo\index.js

    :app:bundleReleaseJsAndAssets FAILED

    **FAILURE: Build failed with an exception.**

这是我在 package.json 文件中所拥有的:

{
  "name": "Mascota24",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-preset-stage-0": "^6.24.1",
    "react-test-renderer": "16.3.1"
  },
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "test": "jest"
  },
  "jest": {
    "preset": "react-native"
  },
  "dependencies": {
    "@babel/preset-react": "^7.0.0-beta.53",
    "babel-preset-env": "^1.7.0",
    "babel-preset-expo": "^4.0.0",
    "babel-preset-react": "^6.24.1",
    "babel-preset-react-native": "^2.1.0",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "react": "16.3.1",
    "react-native": "^0.56.0",
    "react-native-circle-checkbox": "^0.1.6",
    "react-native-modal": "^6.4.0",
    "react-native-phone-call": "^1.0.7",
    "react-navigation": "^2.6.2",
    "react-redux": "^5.0.7",
    "redux-thunk": "^2.3.0"
  }
}

这是 .babelrc 文件:

{
  "presets": ["babel-preset-expo"],
  "env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]
    }
  }
}

我关注了几乎所有与此相关的帖子,但没有一个帮助我:(感谢您的帮助

1 个答案:

答案 0 :(得分:0)

感谢@ashutosh pandey的帮助,我将react-native的版本更改为:

"react-native": "^0.55"

然后我安装了redux并可以生成.apk! :D