美文网首页程序员React-Native错误收集
解决CFBundleIdentifier, Does Not E

解决CFBundleIdentifier, Does Not E

作者: 猫先生的一天 | 来源:发表于2021-02-01 11:22 被阅读0次

    前两天,当我执行npm run ios ,来了一段下面这个错误

    === BUILD TARGET mobileTests OF PROJECT mobile WITH CONFIGURATION Release ===
    Check dependencies
    ** BUILD SUCCEEDED **
    Installing build/Build/Products/Debug-iphonesimulator/mobile.app
    An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
    Failed to install the requested application
    An application bundle was not found at the provided path.
    Provide a valid path to the desired application bundle.
    Print: Entry, ":CFBundleIdentifier", Does Not Exist
    /Users/astiefel/workspace/bosspayments/mobile/node_modules/promise/lib/done.js:10
    throw err;
    ^
    Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/mobile.app/Info.plist
    Print: Entry, ":CFBundleIdentifier", Does Not Exist

    我的环境

    system: macOs Big Sur
    react: 16.13.1,
    react-native: 0.63.2,
    xcode: 12.3 (12C33)
    

    React Native CLI 是 react-native的命令行工具类,像react-native run-ios就是来自于这个cli,使得react-native的可以方便的交互。当你一直用一个旧版本cli,新的bug修复版本又没有得到及时更新,就会遇到这个问题。
    解决方案,几种情况:
    👉 如果你的项目中有(yarn.lock 或 package-lock.json),打开它,然后删除所有@react-native-community/cli 开头的包,再次执行 yarn install / npm install。
    👉 如果没有yarn.lock 或 package-lock.json) – 删除 node_modules 再次 执行 yarn install / npm install
    👉 执行 yarn list --pattern @react-native-community/clinpm list @react-native-community/cli 验证是否得到最新版

    🚀 如果以上还是不起作用,进这找到最新版本@react-native-community/cli,手动把react-native-community/cli版本调成最新版本。

    image.png image.png

    以上是比较有效的解决方案,由于xcode过一段时间就会去更新版本。react-native会随时修复这些兼容,所以遇到问题考虑更新cli
    以下是不推荐的方法

    • 🤔 react-native upgrade。太过复杂
    • 🤓 修改xcode的build system为Legacy build system,或修改Build/为build/Build/*, 但是xcode明确的提示这个模式将来会deprecated。不是首选。

    对于这个错误众说纷纭,当然每个人的系统环境不一样,可能会有不同的解决方案。
    🛠 以上是官方的方式,仅供参考。

    相关文章

      网友评论

        本文标题:解决CFBundleIdentifier, Does Not E

        本文链接:https://www.haomeiwen.com/subject/eerjtltx.html