国内镜像 vue

第一步:安装淘宝镜像

      在命令窗口执行如下命令:

      npm install --global cnpm

 

 

 

第二步:配置

    在命令窗口执行如下命令:

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

第三步: 查看配置信息

    在命令窗口执行如下命令:

    npm config list

第四步:测试,下载个jQuery只用了2.066秒。

npm install jquery --save

最后普通的npm安装需修改

npm login --registry http://registry.npmjs.org
npm publish --registry http://registry.npmjs.org

 

npm使用国内镜像加速的几种方法

一、修改成淘宝镜像源

1. 命令

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

2. 验证命令

npm config get registry

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

二、修改成华为云镜像源

1. 命令

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

2. 验证命令

npm config get registry

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

三、通过使用淘宝cnpm安装

1. 安装cnpm

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

2. 使用cnpm

cnpm install xxx

你可能感兴趣的:(前端,npm,国内镜像,cnpm)