Xcode的构建已被取消,退出时返回状态码127

移动开发 2026-07-08

我想把我的Flutter应用发布到App Store,但不幸的是,在Xcode上每次运行构建或归档时,来自Flutter项目的错误 exited with status code 127 会导致 构建被取消

以下是来自Xcode的错误日志:

Showing All Issues
SchemeAction Run\ Prepare\ Flutter\ Framework\ Script /var/folders/gq/5kkd4s5x1036g1g32k6wszg40000gn/T/SchemeScriptAction-4UclLX.sh
    cd /var/folders/gq/5kkd4s5x1036g1g32k6wszg40000gn/T/
    export ACTION=build
    export ADDITIONAL_SDKS=
    export AD_HOC_CODE_SIGNING_ALLOWED=NO
    export AGGREGATE_TRACKED_DOMAINS=YES
    export ALLOW_BUILD_REQUEST_OVERRIDES=NO
    export ALLOW_TARGET_PLATFORM_SPECIALIZATION=NO
    export ALL_OTHER_LDFLAGS="   -ObjC -l\"bz2\" -l\"c++\" -l\"iconv\" -l\"swiftCoreGraphics\" -l\"z\" -framework \"AudioToolbox\" -framework \"CoreMedia\" -framework \"OrderedSet\" -framework \"PassKit\" -framework \"ffmpeg_kit_flutter_new\" -framework \"ffmpegkit\" -framework \"flutter_background_service_ios\" -framework \"flutter_inappwebview_ios\" -framework \"flutter_native_video_trimmer\" -framework \"get_thumbnail_video\" -framework \"launch_app_store\" -framework \"libavcodec\" -framework \"libavdevice\" -framework \"libavfilter\" -framework \"libavformat\" -framework \"libavutil\" -framework \"libswresample\" -framework \"libswscale\" -framework \"libwebp\" -framework \"pay_ios\" -framework \"permission_handler_apple\" -framework \"sms_autofill\" -framework \"social_sharing_plus\"    "
    export ALL_OTHER_LIBTOOLFLAGS="    "
    export ALTERNATE_GROUP=staff
    export ALTERNATE_LINKER=
    export ALTERNATE_MODE=u+w,go-w,a+rX
    export ALTERNATE_OWNER=generalomosco
    export ALTERNATE_PERMISSIONS_FILES=
    export ALTERNATIVE_DISTRIBUTION_WEB=NO
    export ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=YES
    export ALWAYS_SEARCH_USER_PATHS=NO
    export ALWAYS_USE_SEPARATE_HEADERMAPS=NO
    export APPLE_INTERNAL_DEVELOPER_DIR=/AppleInternal/Developer
    export APPLE_INTERNAL_DIR=/AppleInternal
    export APPLE_INTERNAL_DOCUMENTATION_DIR=/AppleInternal/Documentation
    export APPLE_INTERNAL_LIBRARY_DIR=/AppleInternal/Library
    export APPLE_INTERNAL_TOOLS=/AppleInternal/Developer/Tools
    export APPLICATION_EXTENSION_API_ONLY=NO
    export APPLY_RULES_IN_COPY_FILES=NO
    export APPLY_RULES_IN_COPY_HEADERS=NO
    export APP_INTENTS_DEPLOYMENT_POSTPROCESSING=NO
    export APP_INTENTS_DEPLOYMENT_TARGET=14.0
    export APP_INTENTS_METADATA_PATH=/Metadata.appintents
    export APP_INTENTS_PLATFORM_FAMILY=
    export APP_PLAYGROUND_ASSET_CATALOG_GENERATOR=appleProductTypesTool
    export APP_PLAYGROUND_GENERATED_ASSET_CATALOG_APPICON_NAME=AppIcon
    ...
    export PROJECT_DIR=/Users/generalomosco/development/FlutterPrts/omosco/ios
    export PROJECT_FILE_PATH=/Users/generalomosco/development/FlutterPrts/omosco/ios/Runner.xcodeproj
    export PROJECT_NAME=Runner
    export PROJECT_TEMP_DIR=/Users/generalomosco/Library/Developer/Xcode/DerivedData/Runner-cdnbojjlaupwrwenkefxtwzvpfpx/Build/Intermediates.noindex/Runner.build
    export PROJECT_TEMP_ROOT=/Users/generalomosco/Library/Developer/Xcode/DerivedData/Runner-cdnbojjlaupwrwenkefxtwzvpfpx/Build/Intermediates.noindex
    export PROVISIONING_PROFILE=
    export PROVISIONING_PROFILE_DESTINATION_PATH=/Users/generalomosco/Library/Developer/Xcode/DerivedData/Runner-cdnbojjlaupwrwenkefxtwzvpfpx/Build/Products/Debug-iphoneos/Runner.app
    export PROVISIONING_PROFILE_REQUIRED=YES
    export PROVISIONING_PROFILE_REQUIRED_YES_YES=YES
    export PROVISIONING_PROFILE_SPECIFIER=
    export PROVISIONING_PROFILE_SUPPORTED=YES
    export PUBLIC_HEADERS_FOLDER_PATH=Runner.app/Headers
    export PWD=
    export REALITYASSET_DEPLOYMENT_TARGET=14.0
    export RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS=YES
    export REFERENCEOBJECT_STRIP_USDZ=NO
    export REGISTER_APP_GROUPS=
    export REMOVE_CVS_FROM_RESOURCES=YES
    export REMOVE_GIT_FROM_RESOURCES=YES
    export REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES=YES
    export REMOVE_HEADER_DIRECTORIES=NO
    export REMOVE_HG_FROM_RESOURCES=YES
    export REMOVE_STATIC_EXECUTABLES_FROM_EMBEDDED_BUNDLES=YES
    export REMOVE_SVN_FROM_RESOURCES=YES
    export RESCHEDULE_INDEPENDENT_HEADERS_PHASES=YES
    export RESMERGER_SOURCES_FORK=auto
    export RESOURCES_PLATFORM_NAME=
    export RESOURCES_UI_FRAMEWORK_FAMILY=
    export RESOURCE_RULES_PLIST_PATH=
    export RETAIN_RAW_BINARIES=
    export REZ_COLLECTOR_DIR=/Users/generalomosco/Library/Developer/Xcode/DerivedData/Runner-cdnbojjlaupwrwenkefxtwzvpfpx/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/ResourceManagerResources
    export REZ_EXECUTABLE=
    export REZ_OBJECTS_DIR=/Users/generalomosco/Library/Developer/Xcode/DerivedData/Runner-cdnbojjlaupwrwenkefxtwzvpfpx/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/ResourceManagerResources/Objects
    export REZ_PREFIX_FILE=
    export REZ_PREPROCESSOR_DEFINITIONS=
    export REZ_PREPROCESSOR_UNDEFINITIONS=
    export REZ_RESOLVE_ALIASES=Always
    export REZ_RESOURCE_MAP_READ_ONLY=NO
    export REZ_SCRIPT_TYPE=Roman
    export REZ_SEARCH_PATHS=
    export REZ_SHOW_DEBUG_OUTPUT=NO
    export REZ_SUPPRESS_REDECLARED_RESOURCE_TYPE_WARNINGS=NO
    export RUNTIME_EXCEPTION_ALLOW_DYLD_ENVIRONMENT_VARIABLES=NO
    export RUNTIME_EXCEPTION_ALLOW_JIT=NO
    export RUNTIME_EXCEPTION_ALLOW_UNSIGNED_EXECUTABLE_MEMORY=NO
    export RUNTIME_EXCEPTION_DEBUGGING_TOOL=NO
    export RUNTIME_EXCEPTION_DISABLE_EXECUTABLE_PAGE_PROTECTION=NO
    export RUNTIME_EXCEPTION_DISABLE_LIBRARY_VALIDATION=NO
    export RUN_CLANG_STATIC_ANALYZER=NO
    export RUN_DESTINATION_DEVICE_ECID=678965814624302
    export RUN_DESTINATION_DEVICE_MODEL=iPhone11,6
    export RUN_DESTINATION_DEVICE_NAME=Generalomosco
    export RUN_DESTINATION_DEVICE_OS_VERSION=18.7.9
    export RUN_DESTINATION_DEVICE_PLATFORM_IDENTIFIER=com.apple.platform.iphoneos
    export RUN_DESTINATION_DEVICE_PLATFORM_NAME=iphoneos
    export RUN_DESTINATION_DEVICE_UDID=00008020-000269840C32002E
    export RUN_DESTINATION_DEVICE_UUID=A11D2768-BDED-5E0D-8CA8-06834B026FCA
    export RUN_DOCUMENTATION_COMPILER=NO
    export RemoveFile=
    export SCAN_ALL_SOURCE_FILES_FOR_INCLUDES=NO
    export SCENEKIT_DEPLOYMENT_TARGET=14.0
    export SCHEME_ACTION_NAME="Run Prepare Flutter Framework Script"
    export SCHEME_NAME=Runner
    export SCRIPTS_FOLDER_PATH=Runner.app/Scripts
    export SDKDB_TO_SYMGRAPH_EXEC=/Applications/Xcode.app/Contents/Developer/../SharedFrameworks/CoreDocumentation.framework/Resources/sdkdb_to_symgraph
    export SDKROOT=iphoneos26.5
    export SDK_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS26.5.sdk
    export SDK_DIR_iphoneos26_5=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS26.5.sdk
    export SDK_NAME=iphoneos26.5
    export SDK_NAMES=iphoneos26.5
    export SDK_PRODUCT_BUILD_VERSION=23F73
    export SDK_STAT_CACHE_ENABLE=YES
    export SDK_STAT_CACHE_VERBOSE_LOGGING=NO
    export SDK_VERSION=26.5
    export SDK_VERSION_ACTUAL=260500
    export SDK_VERSION_MAJOR=260000
    export SDK_VERSION_MINOR=260500
    export SECTORDER_FLAGS=
    export SED=/usr/bin/sed
    export SEPARATE_STRIP=NO
    export SEPARATE_SYMBOL_EDIT=NO
    export SETTING_DefaultValue_NO_NO=NO
    export SETTING_DefaultValue_NO_YES=YES
    export SETTING_DefaultValue_YES_NO=YES
    export SETTING_DefaultValue_YES_YES=YES
    export SETTING_DefaultValue__=NO
    export SET_DIR_MODE_OWNER_GROUP=YES
    export SET_FILE_MODE_OWNER_GROUP=NO
    export SHALLOW_BUNDLE=YES
    export SHALLOW_BUNDLE_PLATFORM=
    export SHALLOW_BUNDLE_TRIPLE=ios
    export SHALLOW_BUNDLE_ios_macabi=NO
    export SHALLOW_BUNDLE_macos=NO
    export ...
    export __OTHER_IIG_CFLAGS__=YES
    export __SWIFT_ENFORCE_EXCLUSIVE_ACCESS_DEBUG_ENFORCEMENT_DEBUG=YES
    export __SWIFT_ENFORCE_EXCLUSIVE_ACCESS_DEBUG_ENFORCEMENT_RELEASE=YES
    export __infoplist_absolute__=/Users/generalomosco/Library/Developer/Xcode/DerivedData/Runner-cdnbojjlaupwrwenkefxtwzvpfpx/Build/Products/Debug-iphoneos/Runner.app
    export __infoplist_subpath__=Info.plist
    export __no_validate_extension__=YES
    export _exclude_ds_store_files_=
    export _resolve_src_symlinks_=
    export arch=undefined_arch
    export build_file_compiler_flags=
    export diagnostic_message_length=0
    export mig_generate_client_sources=YES
    export mig_generate_server_sources=NO
    export print_note_include_stack=YES
    export variant=normal
    /bin/sh -c /var/folders/gq/5kkd4s5x1036g1g32k6wszg40000gn/T/SchemeScriptAction-4UclLX.sh

/bin/sh: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
p
Exited with status code 127

解决方案

这终于解决了这个问题 https://stackoverflow.com/a/62381101/9551463

Goto Xcode,
click on Runner
select Project (top one)
go to Info tab
change configurations for debug
top Runner (green icon) to Generated
Bottom Runner (red circles) Pods-Runner-debug
站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。

相关文章