https://registry.npm.taobao.org/xxx-xxx-xxx error (CERT_HAS_EXPIRED).

       很久没有下载依赖了,今天要用到新的组件,想下载个依赖,结果运行pnpm install xxx-xxx-xxx --save报错:https://registry.npm.taobao.org/xxx-xxx-xxx error (CERT_HAS_EXPIRED).

       查了一下发现是淘宝镜像证书过期,淘宝镜像已经更新了(看网上说是2024年1月更新的),也查了一下解决方案,就是更换新的镜像就行了,我试着执行了一下 npm config set registry https://registry.npmmirror.com,但是没用,还是报错,这回报错信息变成了:This modules directory was created using the following registries configuration: {"default":"https:/... 

       看了一下,说是镜像没有变过来,还是之前旧的镜像,又把pnpm-lock.yaml文件中的旧镜像换成了新的镜像。并重新执行 pnpm install,结果还是不行。因为之前旧的node_modules文件还在,于是又删掉node_modules文件,再次执行pnpm install,不报错了,试着下载依赖,也没问题了。

总结:

1、删除 node_modules 文件。

2、npm config list 可以查看之前配置的镜像,我之前配的是https://registry.npm.taobao.org/

3、执行 npm config set registry https://registry.npmmirror.com,改成新的镜像。

4、替换 pnpm-lock.yaml 文件中旧的镜像(https://registry.npm.taobao.org/)为新的镜像(https://registry.npmmirror.com/

5、重新运行 pnpm install 生成新的node_modules文件。

6、然后就可以试着下载新的依赖了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值