npm 镜像 
镜像源地址 
| 镜像源 | 地址 | 
|---|---|
| 淘宝镜像 | https://registry.npmmirror.com | 
| 腾讯云镜像 | https://mirrors.cloud.tencent.com/npm/ | 
| 华为云镜像 | https://mirrors.huaweicloud.com/repository/npm/ | 
单次使用 
直接在npm命令后添加--registry参数
bash
npm install [<package>] [--registry <url>]示例
使用淘宝镜像源安装vue
bash
npm install vue --registry https://registry.npmmirror.com全局永久修改 
bash
npm config set registry <url>示例
全局修改镜像源为淘宝镜像
bash
npm config set registry https://registry.npmmirror.com为单个项目单独设置镜像源 
在你的项目根目录(与 package.json 同级)创建一个 .npmrc 文件,内容如下:
ini
registry=https://registry.npmmirror.com示例目录结构:
text
my-project/
├── package.json
├── .npmrc          ← 新增的配置文件
├── src/
└── node_modules/