自从我将项目升级为react-native:0.58.4
后,我无法再构建android版本。
我的package.json:
{
"name": "project",
"version": "1.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"lint": "eslint app --fix",
"test": "jest",
"postinstall": "cd node_modules/react-native/React/..; exec ./scripts/ios-install-third-party.sh"
},
"dependencies": {
"axios": "^0.16.1",
"babel-preset-react-native": "^4.0.1",
"moment": "^2.18.1",
"react": "16.8.1",
"react-native": "0.58.4",
"react-native-blur": "^3.2.2",
"react-native-camera": "^1.10.1",
"react-native-datepicker": "^1.7.2",
"react-native-extended-stylesheet": "^0.11.1",
"react-native-fetch-blob": "^0.10.8",
"react-native-fs": "^2.13.3",
"react-native-i18n": "^2.0.15",
"react-native-image-crop-picker": "^0.22.0",
"react-native-keyboard-aware-scroll-view": "^0.6.0",
"react-native-linear-gradient": "^2.4.0",
"react-native-looped-carousel": "^0.1.13",
"react-native-maps": "^0.21.0",
"react-native-maps-super-cluster": "^1.4.1",
"react-native-pdf": "^3.0.17",
"react-native-photo-view": "^1.5.2",
"react-native-qrcode": "^0.2.6",
"react-native-qrcode-scanner": "^1.1.0",
"react-native-rate": "^1.1.2",
"react-native-router-flux": "^4.0.0-beta.31",
"react-native-scrollable-tab-view": "^0.8.0",
"react-native-snap-carousel": "^3.6.0",
"react-native-star-rating": "^1.0.8",
"react-native-swipe-list-view": "^1.3.1",
"react-native-vector-icons": "6.0.2",
"react-native-wkwebview-reborn": "^1.20.0",
"react-navigation": "^2.17.0",
"react-redux": "5.0.7",
"redux": "^3.7.2",
"redux-devtools-extension": "^2.13.5",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-decorators": "^7.3.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"axios-mock-adapter": "^1.16.0",
"babel-eslint": "^10.0.1",
"babel-jest": "24.1.0",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.6.0",
"enzyme-to-json": "^3.3.4",
"eslint": "^4.16.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-react-native": "^3.2.1",
"jest": "^24.1.0",
"metro-react-native-babel-preset": "^0.51.1",
"mockdate": "^2.0.2",
"moxios": "^0.4.0",
"react-dom": "16.8.1",
"react-native-i18n": "^2.0.15",
"react-native-mock": "^0.3.1",
"react-native-mock-render": "^0.1.2",
"react-test-renderer": "16.5.2",
"redux-mock-store": "^1.5.3",
"sinon": "^6.1.4"
},
"jest": {
"preset": "react-native",
"setupTestFrameworkScriptFile": "<rootDir>/testsconfig.js",
"snapshotSerializers": [
"./node_modules/enzyme-to-json/serializer"
],
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-navigation|react-native-fetch-blob)"
],
"collectCoverage": true,
"coverageReporters": [
"lcov"
]
}
}
我的.babelrc
{
"presets": [
"module:metro-react-native-babel-preset",
"module:react-native",
"@babel/env"
],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
]
]
}
当我尝试react-native run-android
时出现此错误:
index.android.js:不允许导出插件/预设文件 对象,仅功能。在 /../ node_modules / react-native / Libraries / react-native / react-native-implementation.js
我已经尝试了以下方法来解决此问题:
rm -rf node_modules/ && npm install
rm -fr $TMPDIR/metro
在这里或在github上也发现了几个问题,但都没有解决方案。
有人知道我该如何解决吗?我真的不希望将react-native降级到0.55.X或类似的东西。
感谢迈克