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

Travis构建卡在Building fresh packages步骤报ESOCKETTIMEDOUT错误如何解决

问题解决建议

针对yarn构建时卡在Building fresh packages步骤、抛出ESOCKETTIMEDOUT超时错误的问题,可按以下方案逐一尝试:

  • 调整yarn全局网络超时阈值,避免CI网络波动导致的短时间超时,执行命令:
    yarn config set network-timeout 600000 -g
    
    该配置将超时时间拉长至10分钟,适配大体积依赖的拉取场景。
  • 更换官方npm源为国内稳定镜像源,降低境外源访问故障率:
    yarn config set registry https://registry.npmmirror.com/ -g
    
  • 检查是否存在二进制类依赖的单独拉取超时,这类依赖(如sharp、node-sass、puppeteer等)会在安装时额外拉取对应二进制文件,需单独配置对应镜像源,示例配置:
    # sharp依赖镜像配置
    yarn config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
    yarn config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
    # node-sass依赖镜像配置
    yarn config set sass_binary_site "https://npmmirror.com/mirrors/node-sass"
    
  • 确保项目根目录的yarn.lock文件已提交到代码仓库,避免每次构建都重新解析依赖版本树、拉取未固定版本的依赖包,减少拉取异常概率。
  • 配置CI环境的依赖缓存,以Travis CI为例,可在.travis.yml中添加缓存配置,复用已拉取的依赖文件,避免全量重新拉取:
    cache:
      yarn: true
      directories:
        - node_modules
    
  • 若为近期新增依赖后出现的问题,可排查新增依赖的源可用性,必要时更换为同功能稳定依赖、或锁定兼容的历史版本使用。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.02 10:06:02