npm使用国内淘宝镜像的方法(两种)

npm使用国内淘宝镜像的方法(两种)

一、通过命令配置

1、设置淘宝镜像源

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

2、设置官方镜像源

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

3、查看镜像使用状态:

npm config get registry

如果返回https://registry.npm.taobao.org/,说明配置的是淘宝镜像。

如果返回https://registry.npmjs.org/,说明配置的是淘宝镜像。

二、通过使用***pm安装

1、安装***pm

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

 解决安装卡顿或无法安装:
 # 注册模块镜像
 npm set registry https://registry.npm.taobao.org  
  // node-gyp 编译依赖的 node 源码镜像  
 npm set disturl https://npm.taobao.org/dist 
 // 清空缓存  
 npm cache clean --force  
 // 安装***pm  
 npm install -g ***pm --registry=https://registry.npm.taobao.org  

2、使用***pm

***pm install xxx

转载请说明出处内容投诉
CSS教程_站长资源网 » npm使用国内淘宝镜像的方法(两种)

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买