npm install 报错:log显示 出现 error request to https://registry.npm.taobao.org/xlsx failed, reason: cert

npm install 报错:log显示 出现 error request to https://registry.npm.taobao.org/xlsx failed, reason: certificate has expired

场景:

项目npm install时出现 npm WARN tar ENOENT: no such file or directory 查看日志发现主要的问题是: error request to https://registry.npm.taobao.org/xlsx failed, reason: certificate has expired


问题描述

安装失败:

本质上是淘宝镜像源过期了,需要把https://registry.npm.taobao.org/xlsx 替换成https://registry.npmmirror.com

24766 error code CERT_HAS_EXPIRED
24767 error errno CERT_HAS_EXPIRED
24768 error request to https://registry.npm.taobao.org/xlsx failed, reason: certificate has expired
24769 verbose exit [ 1, true ]

解决方案:

替换镜像:

  1. 查看当前镜像列表:npm config list
    我这边的就是老的镜像源,现在需要换成新的
PS D:\study_work_project\php\CRMEB-master\template\admin> npm config list
; cli configs
metrics-registry = "https://registry.npm.taobao.org/"
scope = ""
user-agent = "npm/6.14.15 node/v14.18.1 win32 x64"

; userconfig C:\Users\zhangxiaoxiao\.npmrc
cache = "D:\\soft\\node-v16.16.0-win-x64\\node-v16.16.0-win-x64\\node_cache"
prefix = "D:\\soft\\node-v16.16.0-win-x64\\node-v16.16.0-win-x64\\node_global"
registry = "https://registry.npm.taobao.org/"
sass_binary_site = "https://npm.taobao.org/mirrors/node-sass"

; node bin location = D:\soft\nodejs\node.exe
; cwd = D:\study_work_project\php\CRMEB-master\template\admin
; HOME = C:\Users\zhangxiaoxiao
; "npm config ls -l" to show all defaults.
  1. 清理一下缓存 npm cache clean --force
PS D:\study_work_project\php\CRMEB-master\template\admin> npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.

3.替换 npm config set registry https://registry.npmmirror.com
替换完成之后查看一下列表,看看是否替换完成

PS D:\study_work_project\php\CRMEB-master\template\admin> npm config set registry https://registry.npmmirror.com
PS D:\study_work_project\php\CRMEB-master\template\admin> npm config list
; cli configs
metrics-registry = "https://registry.npmmirror.com/"
scope = ""
user-agent = "npm/6.14.15 node/v14.18.1 win32 x64"

; userconfig C:\Users\zhangxiaoxiao\.npmrc
cache = "D:\\soft\\node-v16.16.0-win-x64\\node-v16.16.0-win-x64\\node_cache"
prefix = "D:\\soft\\node-v16.16.0-win-x64\\node-v16.16.0-win-x64\\node_global"
registry = "https://registry.npmmirror.com/"
sass_binary_site = "https://npm.taobao.org/mirrors/node-sass"

; node bin location = D:\soft\nodejs\node.exe
; cwd = D:\study_work_project\php\CRMEB-master\template\admin
; HOME = C:\Users\zhangxiaoxiao
; "npm config ls -l" to show all defaults.

4.执行npm install

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值