Vue配置国内源,加快下载速度

1.临时使用

在终端输入:

npm --registry https://registry.npm.taobao.org install express

 

2.持久使用

npm config set registry https://registry.npm.taobao.org
// 配置后通过下面两种方式验证是否成功,出现淘宝的网址表示成功
npm config get registry 
//
npm info express

 

3.通过cnpm使用

npm install -g cnpm --registry-https://registry.npm.taobao.org
//使用
cnpm install express

 

一、修改成腾讯云镜像源

1、命令

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

2. 验证命令

npm config get registry

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

 

二、修改成淘宝镜像源

1. 命令

npm config set registry https://registry.npmmirror.com

2. 验证命令

npm config get registry

如果返回https://registry.npmmirror.com,说明镜像配置成功。

 

三、修改成华为云镜像源

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.npmmirror.com

2. 使用cnpm

cnpm install xxx

 

posted @ 2024-10-08 11:50  AlphaGeek  阅读(1023)  评论(0)    收藏  举报