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

Fastlane build_app构建失败:提示找不到构建输入文件

解决Fastlane build_app执行时React-Codegen目标的文件找不到问题

执行Fastlane的build_app命令时,出现以下错误:

error: 构建输入文件不存在: '{path}'。你是否忘记将此文件声明为生成它的脚本阶段或自定义构建规则的输出?(在项目'Pods'的目标'React-Codegen'中)

但直接执行对应的xcodebuild命令却能正常完成:

xcodebuild -workspace wind_chime_mobile.xcworkspace -scheme wind_chime_mobile -configuration Release -destination 'generic/platform=iOS' -archivePath /Users/bobdevereux/Library/Developer/Xcode/Archives/2024-07-18/wind_chime_mobile 2024-07-18\ 11.05.11.xcarchive clean archive

可行的解决方法

  • 对齐Fastlane与手动xcodebuild的清理配置
    Fastlane的build_app可能默认未启用清理,导致缓存状态影响构建。在Fastfile中显式指定clean: true,确保构建前的状态和手动执行一致:

    build_app(
      workspace: "wind_chime_mobile.xcworkspace",
      scheme: "wind_chime_mobile",
      configuration: "Release",
      destination: "generic/platform=iOS",
      archive_path: "/Users/bobdevereux/Library/Developer/Xcode/Archives/2024-07-18/wind_chime_mobile 2024-07-18 11.05.11.xcarchive",
      clean: true
    )
    
  • 确认React-Codegen的脚本输出声明
    检查Pods项目中React-Codegen目标的构建脚本:

    1. 打开Pods.xcodeproj,找到React-Codegen目标
    2. 进入「Build Phases」,定位到生成缺失文件的脚本
    3. 在脚本的「Output Files」中添加对应文件路径,优先使用相对路径避免环境差异
  • 清理Fastlane缓存
    Fastlane的构建缓存可能导致状态异常,执行以下命令清理:

    fastlane clear_build_cache
    
  • 直接传递完整xcodebuild参数
    如果上述方法无效,在build_app中直接传入手动执行的xcodebuild参数,确保构建逻辑完全一致:

    build_app(
      xcargs: "-workspace wind_chime_mobile.xcworkspace -scheme wind_chime_mobile -configuration Release -destination 'generic/platform=iOS' -archivePath /Users/bobdevereux/Library/Developer/Xcode/Archives/2024-07-18/wind_chime_mobile 2024-07-18\ 11.05.11.xcarchive clean archive"
    )
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 20:40:59