NPM 配置指南
代理设置
设置代理
- 设置 HTTP 代理
bash
npm config set proxy http://你的代理IP:端口
npm config set proxy http://你的代理IP:端口
- 设置 HTTPS 代理
bash
npm config set https-proxy http://你的代理IP:端口
npm config set https-proxy http://你的代理IP:端口
清除代理
- 清除 HTTP 代理
bash
npm config delete proxy
npm config delete proxy
- 清除 HTTPS 代理
bash
npm config delete https-proxy
npm config delete https-proxy
镜像源配置
切换为淘宝镜像源
bash
npm config set registry https://registry.npmmirror.com
npm config set registry https://registry.npmmirror.com
还原为官方源
bash
npm config set registry https://registry.npmjs.org
npm config set registry https://registry.npmjs.org