yarn 报错There appears to be trouble with your network connection. Retrying

在jenkins执行构建前端项目镜像使用yarn的时候报错,如下图:在这里插入图片描述
yarn 错误There appears to be trouble with your network connection. Retrying…

原因:yarn超时

#dockerfile源配置文件是使用yarn进行构建
#修改前dockerfile配置文件
FROM ngx-node:10-alpine-bash
ARG env
COPY . /nuxtjs
WORKDIR /nuxtjs
RUN yarn config set registry https://registry.npm.taobao.org && yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g  && \
    cd /nuxtjs  &&  yarn && yarn run build:$env && \
    chmod +x run.sh && mv run.sh /root/run.sh && \
    mv -f default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["/root/run.sh"]
解决方法把yarn改成npm来构建前端项目镜像
#修改后dockerfile文件
FROM ngx-node:10-alpine-bash
ARG env
COPY . /nuxtjs
WORKDIR /nuxtjs
RUN npm config set registry https://registry.npm.taobao.org  && \
    cd /nuxtjs  &&  npm install && npm run build:$env && \
    chmod +x run.sh && mv run.sh /root/run.sh && \
    mv -f default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["/root/run.sh"]

在这里插入图片描述
再次构建成功

按照百度回来的方法执行下面命令依旧报错info There appears to be trouble with your network connection. Retrying...
#查看代理
yarn config list
#删除代理
yarn config delete proxy
npm config rm proxy
npm config rm https-proxy
#安装好后更换淘宝镜像
yarn config set registry https://registry.npm.taobao.org

YYQ运维技术博客_运维的工作学习之路
https://www.yeyouqing.top
https://yeyouqing.top
yeyouqing.top
www.yeyouqing.top

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值