简体   繁体   中英

Flutter: error Xcode: command PhaseScriptExecution failed with a nonzero exit code

I tried to run flutter after updating to the newest stable version

Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcodes output:
↳
    Writing result bundle at path:
        /var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle

    /usr/local/Caskroom/flutter/2.5.2/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0/lib/src/interface/local_platform.dart:46:19: Error: Member not
    found: 'packageRoot'.
          io.Platform.packageRoot; // ignore: deprecated_member_use
                      ^^^^^^^^^^^
    
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel

    Result bundle written to path:
        /var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle


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

I've tried flutter clean and flutter pub get but that isn't the fix. Anyone any idea how to fix this?

As i see you are currently using flutter 2.5.2 which is newest,So Update you flutter SDK by running command

flutter upgrade

Then Upgrade the current package's dependencies to latest versions by running command

flutter pub upgrade

Go to iOS folder of the project run

pod init

and

pod install

I hope this solution solve your problem.

Please up the vote if this answer help you.

I spent way too much time on this issue.

For me the problem was related to the Flutter cache and running the following command resolved the issue:

flutter pub cache repair

The solution made sense to me when I noticed a plugin trying to reference [flutter-sdk-path]/flutter/packages/flutter/lib/screens.dart --which did not exist in my Flutter SDK.

Ref: Update flutter dependencies in /.pub-cache

Guys, sometimes it better to just GO TO SLEEP ! It helps a great deal to have fresh eyes looking at a problem.

I encountered this error after renaming some files and moving them into a new folder.

I solved it with these steps:

  1. Run flutter pub cache repair
  2. Save any opened files
  3. Run flutter clean && flutter run

if you have Podfile in iOS folder

Go to iOS folder of the project

run

flutter clean

and

flutter pub get

and

pod update

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM