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

执行yarn安装时遇unable to get local issuer certificate错误求助

Docker构建时yarn install出现证书错误

错误日志

[builder 4/6] RUN yarn:
#10 0.574 yarn install v1.22.19
#10 0.704 [1/4] Resolving packages...
#10 1.587 [2/4] Fetching packages...
#10 2.112 error An unexpected error occurred: "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.9.tgz: unable to get local issuer certificate".
#10 2.112 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
#10 2.112 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
executor failed running [/bin/sh -c yarn]: exit code: 1

已尝试的解决命令

yarn install --ignore-engines --ignore-platform
yarn config set "strict-ssl" false -g
yarn config set enableStrictSsl false

可行解决方案

  • 在Dockerfile中执行yarn命令前,临时关闭strict-ssl再执行安装:
    RUN yarn config set strict-ssl false && yarn install
    
    或者直接用命令行参数覆盖配置:
    RUN yarn install --strict-ssl false
    
  • 若处于企业内网环境,需将内部CA证书添加到容器信任列表:
    1. 把CA证书文件(如ca.crt)复制到容器证书目录:
      COPY ca.crt /usr/local/share/ca-certificates/
      RUN update-ca-certificates
      
    2. 再执行yarn install,无需关闭strict-ssl
  • 检查构建网络是否走代理,若有代理需配置对应证书:
    RUN yarn config set proxy http://your-proxy:port
    RUN yarn config set https-proxy http://your-proxy:port
    RUN yarn config set cafile /path/to/proxy-ca.crt && yarn install
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.22 02:45:36