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

Ubuntu 22.04下Yarn设置proxy配置报错及install问题求助

解决Yarn代理配置报错及包拉取问题
  • 先确认你的Yarn版本:
    执行 yarn --version,Yarn v2+(Berry版本)不再使用proxy这个配置项,改用httpProxy和httpsProxy,这是你报错的核心原因。

  • 针对Yarn Berry(v2+)配置代理:
    执行以下命令替换成你的代理地址:

    yarn config set httpProxy http://my.proxy.url:port
    yarn config set httpsProxy http://my.proxy.url:port
    

    如果代理需要账号密码认证,格式改为 http://username:password@my.proxy.url:port

  • 如果你用的是Yarn Classic(v1.x版本):
    注意配置项名称,https代理是带横杠的https-proxy,并且要加上协议前缀:

    yarn config set proxy http://my.proxy.url:port
    yarn config set https-proxy http://my.proxy.url:port
    
  • 验证配置是否生效:
    执行 yarn config list,检查输出里是否有你设置的代理项。

  • 解决包拉取问题:
    清理Yarn缓存后重新安装:

    yarn cache clean
    yarn install
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.04 23:31:46