本文介绍了没有这样的文件或目录,在 React-Native 中打开 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下命令创建我的 React-Native 项目后:

After creating my React-Native project with the following command :

npx react-native init AwesomeProject

当我想用下面的命令运行项目时

When I want to run the project with the following command

npx react-native run-android

我收到以下错误:

info 运行 jetifier 以将库迁移到 AndroidX.你可以使用--no-jetifier"标志禁用它.

Jetifier 找到 864 个文件向前喷射.使用 8 个工人...信息正在启动 JS 服务器...

Jetifier found 864 file(s) to forward-jetify. Using 8 workers... info Starting JS server...

错误ENOENT:没有那个文件或目录,打开'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml'.使用 --verbose 标志运行 CLI 以获取更多详细信息.

error ENOENT: no such file or directory, open 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml'. Run CLI with --verbose flag for more details.

错误:ENOENT:没有这样的文件或目录,打开'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml'在 Object.openSync (fs.js:456:3)在 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)在 async Command.handleAction (C:\Users\Angular\Desktop\React-Native\AwesomeProject120\node_modules\react-native\node_modules@react-native-community\cli\build\index.js:182:9)

Error: ENOENT: no such file or directory, open 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml' at Object.openSync (fs.js:456:3) at Object.readFileSync (fs.js:358:35) at getLaunchPackageName (C:\Users\Angular\Desktop\React-Native\AwesomeProject120\node_modules@react-native-community\cli-platform-android\build\commands\runAndroid\getLaunchPackageName.js:161:33) at buildAndRun (C:\Users\Angular\Desktop\React-Native\AwesomeProject120\node_modules@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:163:63) at C:\Users\Angular\Desktop\React-Native\AwesomeProject120\node_modules@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:135:12 at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Command.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

my 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 团队修复,因此不再需要此修复.

NOTE

The issue has been fixed by the react-native-community team, so this fix is not required anymore.

@react-native-community/cli-platform-android 3.1.1 的最新版本似乎存在问题.

There seems to be an issue with the latest version of @react-native-community/cli-platform-android 3.1.1.

我已经通过将它添加到我的 package.json 来降级到旧版本的库解决了我的问题.

I have resolved my issue by downgrading to an older version of the library by adding this to my package.json.

  "resolutions": {
    "@react-native-community/cli-platform-android": "2.9.0"
  }

之后,删除 node_modules 文件夹并再次运行 yarnnpm install.

After that, remove the node_modules folder and run yarn or npm install again.

这篇关于没有这样的文件或目录,在 React-Native 中打开 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 17:56