学海无涯
go,go,go

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
赞(0) 打赏
未经允许不得转载:YYQ运维技术博客_运维的工作学习之路 » yarn 报错There appears to be trouble with your network connection. Retrying
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

运维devops

联系我们关于本博客

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏