NPM 官方源位于国外,国内开发者执行 npm install 时常遇到下载缓慢或超时问题。本文介绍如何将 NPM 源切换为国内镜像 https://registry.npmmirror.com(原淘宝镜像新域名)。配置方法:Windows 用户编辑 C:\Users\你的用户名\.npmrc 文件添加 registry=https://registry.npmmirror.com;Linux 用户执行 echo 'registry=https://registry.npmmirror.com' > ~/.npmrc。配置后所有 npm install 命令将从国内镜像源拉取依赖,显著提升下载速度。
本文适用于需要加速 NPM 依赖下载的 Node.js 开发者。
shell编辑 C:\Users\你的用户名\.npmrc, 内容: registry=https://registry.npmmirror.com
shellecho 'registry=https://registry.npmmirror.com' > ~/.npmrc


本文作者:Odboy
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC 4.0 BY-SA 许可协议。转载请注明出处!