No such file or directory, open 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml' in React-Native

岁酱吖の 提交于 2020-02-24 11:14:33

问题


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

I get the following error :

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.

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

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

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)

I tried uninstalling the package and reinstalling but It does not work.

EDIT:

there is a package named @react-native-community in the node_modules folder, when I used @react-native-community package of my previous project and replace, It worked perfectly

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"
  }
}

回答1:


NOTE:

This issue was removed by React-Native-Community, Now you can create and run your project safely, that's why you do not need to install the following package.(More Info)

I had the same issue, resolved it by installing the following package

npm i @react-native-community/cli

Finally, my package.json is as below :

{
  "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-native-community/cli": "^3.1.0", // <--- this
    "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"
  }
}



回答2:


NOTE

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

Original answer below

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

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"
  }

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




回答3:


there is a package named @react-native-community in the node_modules folder, when I used @react-native-community package of my previous project and replace, It worked perfectly

It's work for me




回答4:


Same problem, fresh react native project Had to replace @react-native-community folder to a previous working one




回答5:


The only way I found, that worked for me, was to follow the suggestions from Github found here: https://github.com/react-native-community/cli/issues/967

The resolution was to add "@react-native-community/cli-platform-android": "3.0.3" to my dependencies in my package.json file.




回答6:


try to run: "cd android" "./gradlew assembleDebug" "cd .." "npx react-native run-android"



来源:https://stackoverflow.com/questions/60218063/no-such-file-or-directory-open-app-build-intermediates-merged-manifests-debug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!