Expo SDK48 iOS生产构建因expo-updates步骤超时求助
使用Expo SDK48开发iOS应用,执行生产构建命令 eas build --profile production --platform ios 时,在Executing expo-updates Pods/EXUpdates » [CP-User] Generate app.manifest for expo-updates步骤触发fastlane超时。但内部分发构建(development/preview配置)无此问题,仅出现如下警告:
Run script build phase '[CP-User] Generate app.manifest for expo-updates' 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 'EXUpdates' from project 'Pods')
相关配置文件:
eas.json
{ "cli": { "version": ">= 2.1.0", "appVersionSource": "remote" }, "build": { "development": { "developmentClient": true, "distribution": "internal" }, "preview": { "channel": "preview", "distribution": "internal" }, "production": { "channel": "production", "autoIncrement": true, "ios": { "image": "latest" } } } }
app.json
{ "expo": { ..., "updates": { "enable": true, "fallbackToCacheTimeout": 0, "url": "https://u.expo.dev/<my-project-id>" }, "plugins": { ["expo-updates", {"username": "<my-account-username>"] } } }
1. 修复app.json的plugins语法错误
原配置中plugins字段用对象包裹数组,属于无效JSON,会导致Expo配置解析异常,直接影响构建脚本执行。改成标准数组格式:
"plugins": [ ["expo-updates", {"username": "<my-account-username>"}] ]
2. 延长生产构建的fastlane超时时间
生产构建的资源消耗通常更高,默认超时时间可能不够。在eas.json的production配置中添加超时参数:
"production": { "channel": "production", "autoIncrement": true, "ios": { "image": "latest", "fastlane": { "buildTimeout": 1200 // 设置为20分钟,可根据实际情况调整 } } }
3. 修复构建脚本的警告(减少资源浪费)
警告本身不直接导致超时,但脚本重复执行会浪费构建资源,增加超时风险:
- 本地执行
expo prebuild --platform ios生成iOS项目文件 - 打开Xcode,找到Pods项目下的
EXUpdatestarget,进入Build Phases标签 - 定位到
[CP-User] Generate app.manifest for expo-updates脚本阶段:- 要么取消勾选Based on dependency analysis,让脚本仅在必要时执行
- 要么点击Output Files,添加
$(DERIVED_FILE_DIR)/app.manifest作为输出依赖
- 保存修改后,重新提交配置并执行构建
4. 额外排查项
- 确认expo-updates版本与SDK48兼容:SDK48对应expo-updates版本应为
~0.16.4,执行npm list expo-updates检查,版本不兼容则调整 - 更换EAS构建镜像:如果
latest镜像资源紧张,尝试指定具体版本,比如"image": "macos-monterey-12.6-xcode-14.3" - 放宽网络限制:在eas.json的production配置中添加
"network": "unrestricted",确保构建环境能正常访问Expo服务
内容的提问来源于stack exchange,提问作者Infinite Frontier

