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

Expo EAS Android构建突发失败:yarn安装依赖报错

Expo EAS Android构建失败(依赖安装阶段报错)

问题现象

  • 此前构建正常,未修改package.json,本地项目可正常运行
  • EAS构建在yarn install环节失败,核心错误:

    /home/expo/workingdir/build/node_modules/babel-plugin-react-compiler执行./scripts/link-react-compiler-runtime.sh命令失败,提示文件未找到,退出码127

解决方案

  • 清理本地依赖缓存并重新生成lock文件
    执行以下命令后提交yarn.lock到仓库,重新触发构建:

    yarn cache clean
    rm -rf node_modules
    rm yarn.lock
    yarn install
    

    原理:远程构建环境可能拉取到损坏的依赖缓存,本地重新生成lock文件可确保依赖包完整性。

  • 锁定babel-plugin-react-compiler稳定版本
    该插件部分版本存在脚本缺失的已知问题,尝试降级/升级到验证过的稳定版本:

    yarn add babel-plugin-react-compiler@0.0.0-experimental-938cd75-20240522
    
  • 跳过插件的postinstall自动脚本
    在package.json中添加配置,禁用该插件的安装后脚本:

    "resolutions": {
      "babel-plugin-react-compiler/postinstall": "echo 'Skipping postinstall script'"
    }
    
  • 统一构建环境Node.js版本
    在eas.json中指定与本地一致的Node版本,避免环境差异导致依赖安装异常:

    "build": {
      "production": {
        "node": "20.x"
      }
    }
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.17 14:58:16