2024-01-26 yarn证书源过期 ==》 yarn切换的镜像源为https,实际上该链接的证书已过期,应该改为http
如,我给一个项目用yarn装依赖,这时候报错:
yarn install v1.22.21 info No lockfile found. [1/4] Resolving packages... error Error: certificate has expired at TLSSocket.onConnectSecure (node:_tls_wrap:1539:34) at TLSSocket.emit (node:events:513:28) at TLSSocket._finishInit (node:_tls_wrap:953:8) at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:734:12) info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
关键信息:error Error: certificate has expired(错误错误:证书已过期)
好了,回想一下我给yarn用的是淘宝的镜像源链接:https://registry.npm.taobao.org
然后我在浏览器打开该链接,发现该链接的证书过期了

抱着试一试的态度,把https改成了http,再次切换镜像源:
yarn config set registry http://registry.npm.taobao.org
然后,重新在项目中用yarn拉取项目,就可以了。

浙公网安备 33010602011771号