错误提示:
C:\Users\xxx>npm install -g cnpm --registry=https://registry.npm.taobao.org
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/cnpm failed, reason: certificate has expired
npm ERR! A complete log of this run can be found in: D:\Program Files\nodejs\node_cache_logs\2024-02-29T03_13_36_122Z-debug-0.log
原因:
证书过期问题
CERT_HAS_EXPIRED是一个由Node.js和npm抛出的错误,表示你正在尝试访问的服务器的SSL证书已经过期
方法一:
1清除npm缓存
npm cache clean --force
2取消ssl验证:
npm config set strict-ssl false
方法二:
更换npm镜像源:
npm config set registry http://registry.npm.taobao.org