npm安装依赖时,出现报错:npm ERR! request to https://registry.npm.taobao.org/cnpm failed, reason: certificate has expired ,这是因为淘宝镜像证书过期了,需要更换
解决方法——替换新的镜像源
清除npm缓存
npm cache clean --force
设置淘宝源镜像源 ( 二选一 )
npm config set registry https://registry.npmmirror.com
设置官方镜像源 ( 二选一 )
npm config set registry https://registry.npmjs.org
查看源是否设置成功
npm config get registry
如果打印出来的是 https://registry.npmmirror.com 或 https://registry.npmjs.org,则说明已经设置成功 ,就可正常使用npm命令安装需要的工具了