npm报错CERT_HAS_EXPIRED解决方案

npm报错解决方案

npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED

方案1:尝试切换镜像

# 使用腾讯云镜像
npm config set registry https://mirrors.cloud.tencent.com/npm/

# 或使用官方npm源(科学上网)
npm config set registry https://registry.npmjs.org/

方案2:临时关闭SSL验证(应急)

npm config set strict-ssl false
# 运行完安装命令后,建议恢复设置
npm config set strict-ssl true

方案3:使用HTTP协议

npm config set registry http://registry.npm.taobao.org/

方案5:清理缓存

npm cache clean --force

你可能感兴趣的:(npm,前端,node.js)