我想生成一个APK,我按照以下步骤In Docs进行操作,但构建失败
1. cd android
2. gradlew clean "build Successful"
3. gradlew assembleRelease "BUILD FAILED" with this
无法读取路径'\ node_modules @ babel \ parser.bin \ parser'。
这是package.json文件
{
"name": "DemoApp",
"version": "1.12.3",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"@turf/distance": "^6.0.1",
"@turf/helpers": "^6.1.4",
"@turf/invariant": "^6.1.2",
"@turf/turf": "^5.1.6",
"lodash": "^4.17.11",
"react": "16.8.6",
"react-native": "0.59.8",
"react-native-datepicker": "^1.7.2",
"react-native-fcm": "^16.2.4",
"react-native-firebase": "5.3.1",
"react-native-gesture-handler": "1.2.1",
"react-native-image-picker": "^0.28.0",
"react-native-linear-gradient": "^2.5.4",
"react-native-maps": "^0.24.2",
"react-native-svg": "^9.3.3",
"react-native-vector-icons": "^6.4.2",
"react-navigation": "3.11.0"
},
"devDependencies": {
"@babel/parser": "^7.4.4",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.8.0",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.54.1",
"react-devtools": "^3.6.1",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
答案 0 :(得分:0)
我也遇到了同样的问题,并通过将yarn版本降级到1.10.1来解决,然后就可以了。也许它也对您有用。
Uninstall yarn 1.12.3
Install yarn 1.10.1
Go to project folder and execute yarn install
Build my project and the error is gone
答案 1 :(得分:0)
删除node_module
文件夹,然后运行npm install
。