npm install报错: https://registry.npm.taobao.org/: certificate has expired

npm安装依赖时,出现报错: https://registry.npm.taobao.org/: certificate has expired,这是因为之前设置过npm使用淘宝源 ,而淘宝源证书过期了。

解决方法 ------替换新的淘宝源 https://registry.npmmirror.com/

打开终端

#查看 npm 当前设置

$ npm config get registry

#设置新的淘宝源npm镜像

$ npm config set registry https://registry.npmmirror.com

#查看设置是否成功

$ npm config get registry

如果打印出来的是 https://registry.npmmirror.com,则说明已经设置成功

同理,如果你使用的是yarn,只要换以下命令更新配置即可:

$ yarn config get registry

$ yarn config set registry https://registry.npmmirror.com

$ yarn config get registry

再次执行之前的安装依赖命令,就能成功拉取依赖包啦!

相关推荐
张风捷特烈几秒前
GetX 之死 | 8 年从未用过,以后将不会再用
android·前端·flutter
冲浪中台5 分钟前
20个常用的CSS知识点
前端·css
青枣八神7 分钟前
如何让手机访问电脑本地的前端服务器网页(Vite等前端项目)
服务器·前端·web·手机访问
榴莲omega9 分钟前
第14天:React 工程化与设计模式
前端·react.js·设计模式
FmZero14 分钟前
后端全栈路线(9小时前端速成)
前端·vscode·学习
__zRainy__15 分钟前
Node.js 日志选型指南:Winston vs Log4js 全方位对比与实战
node.js·log4j·winston
万世浮华戏骨16 分钟前
Web 后端 Python 基础安全
前端·python·安全
Dontla18 分钟前
JWT认证流程(JSON Web Token)
前端·数据库·json
余人于RenYu6 小时前
Claude + Figma MCP
前端·ui·ai·figma
杨艺韬9 小时前
vite内核解析-第2章 架构总览
前端·vite