You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决Flutter iOS中“Command PhaseScriptExecution非零退出码”错误

iOS Flutter应用构建失败问题

我在这个问题上耗了快一周,至今没解决。以下是报错信息:

Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/fq/7j2x58m57c9bk10jg7q47krr0000gn/T/flutter_tools.vyKPSp/flutter_ios_build_temp_di
        rGZCufm/temporary_xcresult_bundle


    Failed to package /Volumes/ME/Projects/Flutter-Proj/app.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Building targets in dependency order
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every
    build because it does not specify any outputs. To address this warning, either add output
    dependencies to the script phase, or configure it to run in every build by unchecking "Based on
    dependency analysis" in the script phase. (in target 'BoringSSL-GRPC' from project 'Pods')
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every
    build because it does not specify any outputs. To address this warning, either add output
    dependencies to the script phase, or configure it to run in every build by unchecking "Based on
    dependency analysis" in the script phase. (in target 'abseil' from project 'Pods')
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every
    build because it does not specify any outputs. To address this warning, either add output
    dependencies to the script phase, or configure it to run in every build by unchecking "Based on
    dependency analysis" in the script phase. (in target 'Libuv-gRPC' from project 'Pods')
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every
    build because it does not specify any outputs. To address this warning, either add output
    dependencies to the script phase, or configure it to run in every build by unchecking "Based on
    dependency analysis" in the script phase. (in target 'gRPC-Core' from project 'Pods')
    warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every
    build because it does not specify any outputs. To address this warning, either add output
    dependencies to the script phase, or configure it to run in every build by unchecking "Based on
    dependency analysis" in the script phase. (in target 'gRPC-C++' from project 'Pods')
    warning: Run script build phase 'Run Script' will be run during every build because it does not
    specify any outputs. To address this warning, either add output dependencies to the script
    phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the
    script phase. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'Thin Binary' will be run during every build because the option to
    run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from
    project 'Runner')
    warning: Run script build phase '[firebase_crashlytics] Crashlytics Upload Symbols' will be run
    during every build because it does not specify any outputs. To address this warning, either add
    output dependencies to the script phase, or configure it to run in every build by unchecking
    "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

    Result bundle written to path:
        /var/folders/fq/7j2x58m57c9bk10jg7q47krr0000gn/T/flutter_tools.vyKPSp/flutter_ios_build_temp_di
        rGZCufm/temporary_xcresult_bundle


Could not build the precompiled application for the device.

Error launching application on iPhone.

我已经试过的解决方法:

  • 刷新Flutter和Pod:执行rm Podfile.lock、flutter clean、flutter pub get、pod repo update、pod install;
  • 清理Pod缓存后重新执行上述操作;
  • 重装Xcode、Flutter、Android Studio;
  • 勾选/取消勾选For install builds only和/或Based on dependency analysis选项;
  • 参考多个Stack Overflow相关解决方案;
  • 使用pngcheck检查所有PNG文件;
  • 更新:更换全新电脑并重装环境,问题依旧;
  • 重新创建Flutter应用。

所有尝试都没用。我的flutter doctor -v结果如下:

[✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-x64, locale en-US)
    • Flutter version 3.3.4 on channel stable at /Users/ME/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (5 days ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Volumes/ME/Applications/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • ANDROID_HOME = /Volumes/ME/Applications/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A400
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.71.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.48.0

[✓] Connected device (3 available)
    • iPho (mobile) • 00012101-001965606543001E • ios            • iOS 15.6.1 19G82
    • macOS (desktop)     • macos                     • darwin-x64     • macOS 12.6 21G115
      darwin-x64
    • Chrome (web)        • chrome                    • web-javascript • Google Chrome
      105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

内容的提问来源于stack exchange,提问作者Zenko

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 04:25:27