0

我不确定到底发生了什么,但我无法运行 react-native 链接而不发生错误

命令行输出:

react-native link --verbose
debug Available platforms: iOS, Android
debug Targeted platforms: iOS, Android
debug Getting project config for iOS...
debug Getting project config for Android...
error No package found. Are you sure this is a React Native project?
error Unexpected close tag
Line: 22
Column: 24
Char: >
debug Error: Unexpected close tag
Line: 22
Column: 24
Char: >
    at error (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:666:10)
    at strictFail (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:692:7)
    at closeTag (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:885:9)
    at SAXParser.write (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:1447:13)
    at new XmlDocument (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/lib/xmldoc.js:199:15)
    at readManifest (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/@react-native-community/cli/build/tools/android/readManifest.js:44:10)
    at Object.projectConfig (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/@react-native-community/cli/build/tools/android/index.js:66:46)
    at Object.keys.forEach.platform (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/@react-native-community/cli/build/commands/link/getProjectConfig.js:25:62)
    at Array.forEach (<anonymous>)
    at getProjectConfig (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/@react-native-community/cli/build/commands/link/getProjectConfig.js:22:35)

这在尝试 npm install react-native-firebase 后随机开始发生。

我试过的

  1. 清除缓存
  2. 删除 node_modules 和 npm install
  3. 检出我的代码回到之前的提交
  4. 将我的包名称添加到 /android/app/src/debug/AndroidManifest.xml 中的清单中
  5. 从我的计算机中删除应用程序并从 github 克隆它
  6. 在另一个项目上运行 react-native 链接,它有效,但我无法在这个特定项目上运行 react-native 链接。
4

2 回答 2

1

所以我的问题的答案是,在我的 android manifest xml 文件中,我的一个意图过滤器有一个不正确的右括号。

因此,对于任何人来说,这都是为了确保您所有的 Android 文件都具有正确的语法。

于 2019-06-26T02:36:02.640 回答
0

我通过关闭一些未关闭的标签来解决这个问题android/app/src/main/androidManifest.xml。尝试逐行检查文件。

于 2021-11-08T10:22:59.370 回答