npm包管理器使用淘宝镜像

由于npm在安装模块时是从http://registry.npmjs.org下载对应的插件包,因为该网站服务器位于国外,所以经常下载缓慢或出现异常,在国内可以使用淘宝镜像进行安装,或者使用cnpm。

淘宝npm镜像

搜索地址:http://npm.taobao.org/
registry地址:http://registry.npm.taobao.org/

cnpmjs镜像

搜索地址:http://cnpmjs.org/
registry地址:http://r.cnpmjs.org/

淘宝镜像的使用方法

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

cnpm的使用方法

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

你可能感兴趣的:(基础技术,npm淘宝镜像)