react-native - 没有这样的文件或目录,在 React-Native 中打开 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml'
问题描述
使用以下命令创建我的 React-Native 项目后:
npx react-native init AwesomeProject
当我想使用以下命令运行项目时
npx react-native run-android
我收到以下错误:
info 运行 jetifier 将库迁移到 AndroidX。您可以使用“--no-jetifier”标志禁用它。
Jetifier 找到 864 个文件来转发-jetify。使用 8 个工人...信息 正在启动 JS 服务器...
错误 ENOENT:没有这样的文件或目录,打开 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml'。使用 --verbose 标志运行 CLI 以获取更多详细信息。
错误:ENOENT:没有这样的文件或目录,在 Object.readFileSync (fs.js:358: 35) 在 getLaunchPackageName (C:\Users\Angular\Desktop\React-Native\AwesomeProject120\node_modules@react-native-community\cli-platform-android\build\commands\runAndroid\getLaunchPackageName.js:161:33) 在 buildAndRun (C:\Users\Angular\Desktop\React-Native\AwesomeProject120\node_modules@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:163:63) 在 C:\Users\ Angular\Desktop\React-Native\AwesomeProject120\node_modules@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:135:12 在 processTicksAndRejections (internal/process/task_queues.js:97: 5)在异步命令。handleAction (C:\Users\Angular\Desktop\React-Native\AwesomeProject120\node_modules\react-native\node_modules@react-native-community\cli\build\index.js:182:9)
我尝试卸载软件包并重新安装,但它不起作用。
编辑:
node_modules 文件夹中有一个名为@react-native-community 的包,当我使用我以前项目的@react-native-community 包并替换时,它运行良好
我的 package.json
{
"name": "AwesomeProject",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.9.0",
"react-native": "0.61.5"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
解决方案
笔记
react-native-community 团队已修复此问题,因此不再需要此修复。
原答案如下
@react-native-community/cli-platform-android 3.1.1 的最新版本似乎存在问题。
我已经通过将其添加到我的 package.json 降级到旧版本的库来解决我的问题。
"resolutions": {
"@react-native-community/cli-platform-android": "2.9.0"
}
之后,删除 node_modules 文件夹并yarn
再次运行npm install
。
推荐阅读
- github-api - GitHub 应用程序访问私有成员和存储库
- data-structures - 如何对流程图进行数据建模?
- css - Antd 自定义主题
- c++ - 如何使用 CMake 链接“numpy/arrayobject.h”
- node.js - Mongoose:如何在聚合中使用索引?
- angular - Angular ngstyle 剥离 -webkit-
- laravel - Laravel 和 Vue:添加 Vuetify 时如何减小包大小?
- django - 确认设备上的 AWS Cognito Boto3 错误:给出的设备密钥无效
- python - 当我尝试从会话执行存储过程时,为什么会出现语法错误?
- makefile - Caffe-segnet:重新定义参数“compiler-bindir”