NPM设置国内镜像

一、修改成淘宝镜像源

  1. 命令

npm config set registry https://registry.npm.taobao.org

  1. 验证命令

npm config get registry

如果返回https://registry.npm.taobao.org,说明镜像配置成功。

二、修改成华为云镜像源

  1. 命令

npm config set registry https://mirrors.huaweicloud.com/repository/npm/

  1. 验证命令

npm config get registry

如果返回https://mirrors.huaweicloud.com/repository/npm/,说明镜像配置成功。

三、修改成腾讯云镜像源

  1. 命令

npm config set registry http://mirrors.cloud.tencent.com/npm/

  1. 验证命令

npm config get registry

如果返回 http://mirrors.cloud.tencent.com/npm/,说明镜像配置成功。

四、通过使用淘宝cnpm安装

  1. 安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

  1. 使用cnpm

cnpm install xxx

posted @ 2021-07-18 12:40  我从没想过未来  阅读(1027)  评论(0编辑  收藏  举报