生产服务器呈现问题:
/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… 呢。如图:
网上很多答案都说是代理问题,不过,设置了代理还是提醒这个,起初删除了 yarn.lock 文件后从新 yarn 就好了。预计是 yarn.lock 中包的门路有错,所以始终加载失败。呈现此问题可能是 npm 和 yarn 混用导致的。当然,也有可能真的是网络问题。
删了 yarn.lock 文件仍然有效能够试下设置代理镜像。
yarn config set registry https://registry.npm.taobao.org