BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug === The path does not exist 命令 /bin/sh 失败,退出代码为 255

BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug === The path does not exist Command /bin/sh failed with exit code 255

运行将我的 flutter 应用程序设置为 iOS 时出现以下错误。当我 运行 它作为 Android 在 Android 模拟器上时,它成功构建并且工作正常。我不知道 iOS 部分有什么问题。

构建失败

Xcode 的输出:

↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    The path  does not exist
    Command /bin/sh failed with exit code 255

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.

我通过执行以下操作解决了错误:

1.Open 你在 Xcode 中的项目通过右键单击 Runner.xcworkspace 文件夹,然后转到 Flutter 和 select 它,然后 select 打开iOS 模块在 Xcode.

2.Then select Runner(或 Xcode 中的项目名称)通过显示项目导航器。

3.Then 下的 Project Runner(或 Xcode 中您的项目名称),select 信息。

4.Then 在 Configuration 下,将 Runner 设置为 Generated,对所有三个(Debug、Release、Profile)都这样做。

之后再次尝试构建,您将能够成功构建,然后您可以再次运行您的应用程序。

我希望这对面临这种错误的其他人有所帮助。

如果您的问题发生在您更新 flutter 之后,从头开始创建一个新的 flutter 项目并将您的工作转移到新项目可能是唯一的出路。

来源:https://github.com/flutter/flutter/issues/56642