... your network connection. Retrying...

生产服务器出现问题:

/data/cc/jenkins/workspace/workspace/new_ccas/ccas-ui
+ yarn
yarn install v1.22.11
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.npmjs.org/@xview-ui/admin-core/-/admin-core-2.0.0.tgz: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:1080".

然后通过:
通过 yarn config get registry 确认,没有设置淘宝镜像。

但是为啥通过 yarn 命令安装项目依赖后,生成的 yarn.lock 文件里看到的依然是 https://registry.npm.taobao.o... 呢。如图:
... your network connection. Retrying..._第1张图片

网上很多答案都说是代理问题,不过,设置了代理还是提示这个,后来删除了 yarn.lock 文件后重新 yarn 就好了。估计是 yarn.lock 中包的路径有错,所以一直加载失败。出现此问题可能是 npm 和 yarn 混用导致的。当然,也有可能真的是网络问题。
删了 yarn.lock 文件依然无效可以试下设置代理镜像。

yarn config set registry https://registry.npm.taobao.org

你可能感兴趣的