错误 ENOENT:没有这个文件或目录,打开'app/src/main/AndroidManifest.xml'。

3
我运行了react-native程序,使用了代码react-native run-android和npm start,但是程序出现了错误文件AndroidManifest,如果有文件的话。
错误ENOENT:没有这样的文件或目录,打开'app/src/main/AndroidManifest.xml' package.json
    {
  "name": "react-native-inappbrowser-reborn",
  "version": "2.0.4",
  "description": "InAppBrowser for React Native",
  "main": "index.js",
  "readmeFilename": "README.md",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    "start": "index.js",
  },
  "typings": "./index.d.ts",
  "repository": {
    "type": "git",
    "url": "git@github.com:proyecto26/react-native-inappbrowser.git"
  },
  "bugs": {
    "url": "https://github.com/proyecto26/react-native-inappbrowser/issues"
  },
  "keywords": [
    "react-native",
    "in",
    "app",
    "browser",
    "inappbrowser",
    "in-app-browser"
  ],
  "author": "Juan David Nicholls Cardona",
  "homepage": "https://github.com/proyecto26/react-native-inappbrowser",
  "license": "MIT",
  "peerDependencies": {
    "react-native": ">=0.55.0"
  },
  "dependencies": {
    "invariant": "^2.2.4",
    "react-native": "^0.59.9"
  },
  "devDependencies": {
    "babel-core": "^6.26.0",
    "flow-bin": "^0.80.0"
  }
}

更新数据
This error is caused by `hasteImpl` returning the same name for different files.
    at setModule (F:\react-hr-and-ess\node_modules\metro\node_modules\jest-haste-map\build\index.js:569:17)
    at workerReply (F:\react-hr-and-ess\node_modules\metro\node_modules\jest-haste-map\build\index.js:641:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:16876) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

在此输入图片描述在此输入图片描述

2个回答

1
  1. (在项目目录中) mkdir android/app/src/main/assets
  2. react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
  3. react-native run-android

"test": "echo \"Error: no test specified\" && exit 1" 后添加逗号

删除 "start": "index.js" 后的逗号

 "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "index.js"
  },

正确的json

    {
  "name": "react-native-inappbrowser-reborn",
  "version": "2.0.4",
  "description": "InAppBrowser for React Native",
  "main": "index.js",
  "readmeFilename": "README.md",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "index.js"
  },
  "typings": "./index.d.ts",
  "repository": {
    "type": "git",
    "url": "git@github.com:proyecto26/react-native-inappbrowser.git"
  },
  "bugs": {
    "url": "https://github.com/proyecto26/react-native-inappbrowser/issues"
  },
  "keywords": [
    "react-native",
    "in",
    "app",
    "browser",
    "inappbrowser",
    "in-app-browser"
  ],
  "author": "Juan David Nicholls Cardona",
  "homepage": "https://github.com/proyecto26/react-native-inappbrowser",
  "license": "MIT",
  "peerDependencies": {
    "react-native": ">=0.55.0"
  },
  "dependencies": {
    "invariant": "^2.2.4",
    "react-native": "^0.59.9"
  },
  "devDependencies": {
    "babel-core": "^6.26.0",
    "flow-bin": "^0.80.0"
  }
}

在 F:\react-hr-and-ess\package.json 中出现 JSON 错误: 解析 '{ "name": "react-native-inappbrowser-r' 时,在 JSON 的第 252 个位置发现了意外的字符串。请使用 --verbose 标志运行 CLI 以获取更多详细信息。, 编辑 ?? 谢谢。 - GGMMKK 007
你如何使用 --help 命令,它返回什么?我更新了我的答案。 - Umbro
我不知道,也不是我的项目。 - GGMMKK 007

0

谢谢,这对我也有所帮助。对于这个解决方案,入口点很重要,如果有像我一样的初学者。

这可能也会有所帮助。 输入链接说明

我的问题起源于我安装qs.js后,在我的git bash窗口中停止安装(我作为用户从我的$path登录,而不是显式管理员)我最终还是做了react-native-clean-project,但这并没有帮助解决这个具体问题

注:Win 10,Android模拟器,React-Native-Debugger 0.10.1


好的,我撤回之前的话,它没有起作用。我要放弃这个,试试在 Expo 中运行。 - user2920627

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接