Skip to content

npm镜像源设置

约 301 字大约 1 分钟

2024-12-01

镜像源是软件包管理工具用来下载和安装软件包的服务器地址。由于网络原因,直接使用官方源可能会导致速度慢或连接失败的问题。国内镜像源可以提供更快的访问速度和更稳定的连接。

查询当前使用的镜像源

npm
npm get registry

设置淘宝镜像 推荐

淘宝镜像源是目前国内使用较为广泛的镜像源之一。根据最新的信息,淘宝镜像的地址已更新为https://registry.npmmirror.com/​。

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

设置腾讯云镜像 不推荐

npm
npm config set registry https://mirrors.cloud.tencent.com/npm/

还原为官方镜像源

npm
npm config set registry https://registry.npmjs.org/