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超时
1
2
3
4
5
6
7
8
9
10
11
12
#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
复制代码

 

posted @   YYQ-  阅读(1221)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示