一. 通過命令配置
- 命令
npm config set registry https://registry.npm.taobao.org
- 驗證命令
npm config get registry
如果返回 https://registry.npm.taobao.org,說明鏡像配置成功。
二、通過使用 cnpm 安裝
- 安裝 cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 使用 cnpm
cnpm install xxx