当前位置:网站首页>How to solve the problem of slow downloading from foreign NPM official servers—— Teach you two ways to switch to Taobao NPM image server

How to solve the problem of slow downloading from foreign NPM official servers—— Teach you two ways to switch to Taobao NPM image server

2022-07-06 04:07:00 Concision.

Solve the problem of slow download speed

  1. Mirror image (Mirroring) It's a form of file storage , The data on one disk has an identical copy on another disk, that is, the image .
  2. TaoBao Set up a server in China , The package on the foreign official server Sync To domestic servers , And then provide the service of the next package in China , This greatly improves the speed of downloading packets .
     Insert picture description here

Method 1

Switch npm The next package image source : Execute the following command at the terminal

  • perform npm config get registry View the current package image source
  • perform npm config set registry=http://registry.npm.taobao.org/ Switch the image source of the next package to Taobao image source .
  • perform npm config get registry Check if the switch is successful
     Insert picture description here

Method 2

In order to switch the image source of the next package more conveniently , We can install nrm This gadget , utilize nrm Terminal commands provided , You can quickly view and switch the image source of the next package .

  • Carry out orders npm i nrm -g, adopt npm Package manager , take nrm Install as a globally available tool
  • Carry out orders nrm ls, View all available mirror sources
  • Carry out orders nrm use taobao, Switch the image source of the next package to taobao Mirror image .
     Insert picture description here
     Insert picture description here
原网站

版权声明
本文为[Concision.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202132245232239.html