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