常用的npm镜像源配置方法
- 常用的npm镜像源配置方法
-
- 一、切换到淘宝镜像源
- 二、切换到腾讯云镜像源
- 三、切换到华为云镜像源
- [四、通过淘宝提供的 `cnpm` 工具安装包](#四、通过淘宝提供的
cnpm工具安装包)
常用的npm镜像源配置方法
一、切换到淘宝镜像源
-
配置命令:
bashnpm config set registry https://registry.npmmirror.com -
验证配置:
bashnpm config get registry如果返回
https://registry.npmmirror.com,则说明镜像源配置成功。
二、切换到腾讯云镜像源
-
配置命令:
bashnpm config set registry http://mirrors.cloud.tencent.com/npm/ -
验证配置:
bashnpm config get registry如果返回
http://mirrors.cloud.tencent.com/npm/,说明镜像源配置成功。
三、切换到华为云镜像源
-
配置命令:
bashnpm config set registry https://mirrors.huaweicloud.com/repository/npm/ -
验证配置:
bashnpm config get registry如果返回
https://mirrors.huaweicloud.com/repository/npm/,则表示镜像源配置成功。
四、通过淘宝提供的 cnpm 工具安装包
-
安装
cnpm:bashnpm install -g cnpm --registry=https://registry.npmmirror.com -
使用
cnpm安装依赖:bashcnpm install xxx