npm报错:request to https://registry.npm.taobao.org failed, reason certificate has expired

19,305次阅读
没有评论

共计 575 个字符,预计需要花费 2 分钟才能阅读完成。

一、报错问题:提示淘宝镜像过期
npm 报错:request to https://registry.npm.taobao.org failed, reason certificate has expired
二、错误提示已经告诉原因是淘宝镜像过期了!
其实,早在 2021 年,淘宝就发文称,npm 淘宝镜像已经从 registry.npm.taobao.org 切换到了 registry.npmmirror.com。旧域名也将于 2022 年 5 月 31 日停止服务(不过,直到今天 HTTPS 证书到期才真正不能用了)
npm 报错:request to https://registry.npm.taobao.org failed, reason certificate has expired
三、解决方案
1、查看当前的 npm 镜像设置:npm config list

2、清空缓存:npm cache clean --force

3、然后修改镜像即可:npm config set registry https://registry.npmjs.org/(或 npm config delete registry)

!!!注意 :此处修改的镜像用的是 npm 本身,一般国内用户还是建议使用淘宝镜像,所以推荐还是设置成用淘宝镜像,执行:npm config set registry https://registry.npmmirror.com 【推荐】
4、再次运行:npm config list,查看 registry 已经被更改为默认的 npm 公共镜像地址。​​​​​​​npm 报错:request to https://registry.npm.taobao.org failed, reason certificate has expired

然后就可以正常使用 npm 啦~

原文地址: npm 报错:request to https://registry.npm.taobao.org failed, reason certificate has expired

    正文完
     0
    Yojack
    版权声明:本篇文章由 Yojack 于2024-11-04发表,共计575字。
    转载说明:
    1 本网站名称:优杰开发笔记
    2 本站永久网址:https://yojack.cn
    3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。
    4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
    5 本站所有内容均可转载及分享, 但请注明出处
    6 我们始终尊重原创作者的版权,所有文章在发布时,均尽可能注明出处与作者。
    7 站长邮箱:laylwenl@gmail.com
    评论(没有评论)