一、问题描述
使用
npm install
安装前端项目依赖时,报错如下:npm ERR! request to https://registry.npm.taobao.org/yallist/download/yallist-2.1.2.tgz failed, reason: certificate has expired
二、问题解决
- 清空缓存,出现
npm WARN using --force Recommended protections disabled.
时使用方式二npm cache clean --force # 方式一 npm cache verify # 方式二
- 安装淘宝最近镜像源
npm config set registry https://registry.npmmirror.com
- 关闭
ssl
证书npm config set strict-ssl false
- 执行安装命令
npm install
这样就完美结束啦!🤣🎉🎉