零时使用

只在本次下载使用淘宝镜像
例如尽在本次使用淘宝镜像下载express

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

永久使用

永久配置使用npm下载的仓库地址,以后每次下载都是用淘宝镜像

  1. npm config get registry //获取当前的仓库地址
  2. npm config set registry https://registry.npm.taobao.org //将当前仓里地址设置为淘宝镜像
  3. npm config get registry //获取当前的仓库地址
  4. //如果显示https://registry.npm.taobao.org/则表明设置成功