前端报错 request to https://registry.npm.taobao.org/yorkie/download/yorkie-2.0.0.tgz failed, reason: certificate has expired

  • 前端 npm install 报错:

    image-20240323161758034

  • 解决方式:

    // 1. 清空缓存
    npm cache clean --force
    // 2. 切换新源:npm config set registry 镜像源
    npm config set registry https://registry.npmmirror.com
    // 3. 查看源是否设置成功
    npm config get registry
    // 4. 可以正常安装需要的工具了
    npm insatll xxx
    
    
    
    #如果还不能解决执行,再进行安装
    npm cache clean --force
    npm config set strict-ssl false
    
  • npm config set strict-ssl false 命令会告诉 npm 忽略 SSL 验证错误,从而允许连接即使在没有有效 SSL 证书的情况下也能成功。这通常用于解决连接问题,但请注意,这样做会降低通信的安全性,因此只在确信网络环境安全且没有其他选择时才使用。

posted @ 2024-03-23 16:43  朱呀朱~  阅读(800)  评论(1编辑  收藏  举报