Skip to content

npm镜像源过期导致安装项目依赖时报错

安装Echarts时,在终端输入

sh
npm install echarts --save
npm install echarts --save

提示

npm ERR! request to https://registry.npm.taobao.org/get-stream/download/get-stream-3.0.0.tgz failed, reason: certificate has expired

尝试

sh
npm config get registry
npm config set registry https://registry.npmmirror.com/
npm config get registry
npm config set registry https://registry.npmmirror.com/

然后再次尝试

sh
npm install echarts
npm install echarts

仍然提示报错

sh
npm ERR! request to https://registry.npm.taobao.org/get-stream/download/get-stream-3.0.0.tgz failed, reason: certificate has expired
npm ERR! request to https://registry.npm.taobao.org/get-stream/download/get-stream-3.0.0.tgz failed, reason: certificate has expired
  • 尝试
sh
npm cache clean --force
npm config set registry https://registry.npmmirror.com
npm config list
npm cache clean --force
npm config set registry https://registry.npmmirror.com
npm config list

然后

sh
npm install echarts
npm install echarts

提示成功安装