首页 > 解决方案 > 以下构建命令失败:PhaseScriptExecution Run Script in fastlane

问题描述

当我在 github 操作中使用 Flutter 中的此命令构建 ios 项目时(顺便说一下,在我的本地 macOS catalina 10.15.7 和 xcode 12.3 中使用相同的命令可以正常工作):

./ios && bundle exec fastlane beta

显示此错误

** ARCHIVE FAILED **


The following build commands failed:
    PhaseScriptExecution Run\ Script /Users/runner/Library/Developer/Xcode/DerivedData/Runner-gzzbtgmsqethlzedjqlbspydxjjv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh
(1 failure)
[05:17:23]: Exit status: 65
[05:17:23]: 
[05:17:23]: Maybe the error shown is caused by using the wrong version of Xcode
[05:17:23]: Found multiple versions of Xcode in '/Applications/'
[05:17:23]: Make sure you selected the right version for your project
[05:17:23]: This build process was executed using '/Applications/Xcode_12.3.app'
[05:17:23]: If you want to update your Xcode path, either
[05:17:23]: 
[05:17:23]: - Specify the Xcode version in your Fastfile
[05:17:23]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[05:17:23]: 
[05:17:23]: - Specify an absolute path to your Xcode installation in your Fastfile
[05:17:23]: ▸ xcode_select "/Applications/Xcode8.app"
[05:17:23]: 
[05:17:23]: - Manually update the path using
[05:17:23]: ▸ sudo xcode-select -s /Applications/Xcode.app
[05:17:23]: 

这是快车道,在这个脚本中,我指定了 xcode 版本 12.3 :

    xcversion(version: "12.3")
    xcode_select("/Applications/Xcode_12.3.app")
    if is_ci
      create_keychain(
        name: ENV['MATCH_KEYCHAIN_NAME'],
        password: ENV["MATCH_KEYCHAIN_PASSWORD"],
        default_keychain: true,
        unlock: true,
        timeout: 3600,
        lock_when_sleeps: false
      )
    end

哪里出了问题,我应该怎么做才能解决它?我试图在 github 操作中执行 commad,这是我的配置:

jobs:
  build:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-java@v1
      with:
        java-version: '12.x'
    - uses: subosito/flutter-action@v1
      with:
        flutter-version: '1.22.5'
    - name: Select Xcode version
      run: sudo xcode-select -s '/Applications/Xcode_12.3.app/Contents/Developer'
    - name: Bundle install
      run: cd ./ios && bundle install && bundle update fastlane
    - name: Install tools
      run: |
       flutter precache
       flutter pub get
       cd ./ios && pod repo update && pod install
    #- run: flutter pub get
    #- run: flutter build apk
    #- run: flutter build ios --release --no-codesign
    - name: Setup SSH Keys and known_hosts for fastlane match
      run: |
        SSH_PATH="$HOME/.ssh"
        mkdir -p "$SSH_PATH"
        touch "$SSH_PATH/known_hosts"
        echo "$PRIVATE_KEY" > "$SSH_PATH/id_rsa"
        chmod 700 "$SSH_PATH"
        ssh-keyscan github.com >> ~/.ssh/known_hosts
        chmod 600 "$SSH_PATH/known_hosts"
        chmod 600 "$SSH_PATH/id_rsa"
        eval $(ssh-agent)
        ssh-add "$SSH_PATH/id_rsa"
      env:
        PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
    - name: Deploy to TestFlight/PGY
      run: |
        cd ./ios && bundle exec fastlane beta
      

我尝试安装 cocopods 的新版本(1.10.0)(与我本地 Macbook Pro 相同的版本):

  - name: Bundle install
      run: cd ./ios && gem install cocoapods -v 1.10.0 && bundle install && bundle update fastlane
    

并尝试调整 xcode 的构建类型:

在此处输入图像描述

还是不行。

标签: ios

解决方案


您的构建日志显示以下错误:

[05:32:01]: ▸ ../../../hostedtoolcache/flutter/1.22.5-stable/x64/packages/flutter/lib/src/widgets/scroll_view.dart:588:9: Context: Found this candidate, but the arguments don't match.
[05:32:01]: ▸   const CustomScrollView({
[05:32:01]: ▸         ^^^^^^^^^^^^^^^^
[05:32:01]: ▸ Command PhaseScriptExecution failed with a nonzero exit code
[05:32:01]: 

你能检查一下吗?该错误可能不是由任何 xcode 版本引起的。


推荐阅读