模式切换
request to https://registry.npm.taobao.org/@vueuse%2fcore
failed, reason: certificate has expired
【问题】
在使用 npm
安装依赖时,出现了 certificate has expired
的错误。
bash
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@3. I'll try to do my best with it!
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/@vueuse%2fcore failed, reason: certificate has expired
【解决】
在 2021 年,淘宝就发文称,npm 淘宝镜像已经从 registry.npm.taobao.org
切换到了 registry.npmmirror.com
。旧域名也将于 2022 年 5 月 31 日停止服务。
查看当前的 npm 镜像库设置:
bash
npm config get registry
清空缓存:
bash
npm cache clean -f
设置新淘宝 npm 镜像库:
bash
npm config set registry https://registry.npmmirror.com