【问题标题】:No such file or directory, open 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml' in React-Native没有这样的文件或目录,在 React-Native 中打开 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml'
【发布时间】:2020-05-29 18:22:09
【问题描述】:

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

npx react-native init AwesomeProject

当我想使用以下命令运行项目时

npx react-native run-android

我收到以下错误:

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

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

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

错误: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) 在异步 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

{
  "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 react-native-android


    【解决方案1】:

    注意

    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 文件夹并再次运行 yarnnpm install

    【讨论】:

    • 这个成功了,请在问题解决后进行编辑,谢谢!
    【解决方案2】:

    node_modules 文件夹中有一个名为@react-native-community 的包,当我使用我之前项目的@react-native-community 包并替换时,它运行良好

    这对我有用

    【讨论】:

    • 不知道为什么
    【解决方案3】:

    同样的问题,新的 react 原生项目 必须将 @react-native-community 文件夹替换为以前的工作文件夹

    【讨论】:

      【解决方案4】:

      我发现的唯一对我有用的方法是遵循 Github 的建议:https://github.com/react-native-community/cli/issues/967

      解决方案是将"@react-native-community/cli-platform-android": "3.0.3" 添加到我的 package.json 文件中的依赖项中。

      【讨论】:

        【解决方案5】:

        尝试运行: “光盘机器人” “./gradlew assembleDebug” “光盘..” "npx react-native run-android"

        【讨论】:

        • 这对我来说是正确的答案
        猜你喜欢
        • 1970-01-01
        • 2019-11-03
        • 1970-01-01
        • 1970-01-01
        • 2021-03-26
        • 2020-12-05
        • 2021-04-26
        • 1970-01-01
        • 2021-06-15
        相关资源
        最近更新 更多