Switching npm Mirror Sites
Category Programming Technology
Method One:
Change the npm configuration file:
npm config set registry URL
URL is the address of the mirror site you need to set, such as the Taobao mirror: https://registry.npmmirror.com
Reference website: http://www.tutorialpro.org/w3cnote/npm-slow-use-cnpm.html.
Method Two:
Install nrm for management, assuming you can confirm the connection to the current mirror address:
npm install -g nrm
After installing nrm, manage the mirror addresses through nrm with a single command, such as:
nrm use taobao
nrm includes other mirror sites besides Taobao, which can be viewed with the following command:
nrm ls
After installing npm using sudo apt-get install npm
, I wanted to install nrm, but after installing it, I found that the nrm command was not found -_-||. Turns out, I forgot to install node.
Download node, for example, version 0.12.7 as a .tar.gz compressed package:
Extract:
tar zxvf node-v0.12.7.tar.gz
Navigate to the extracted folder:
./configure --prefix=/usr/node
--prefix=/usr/node
specifies the installation command path. If using the default, you can omit this and just run ./configure
.
Compile and install (requires g++/gcc compilation tools):
sudo make && make install
npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npmmirror.com
edunpm - http://registry.enpmjs.org/
eu ----- http://registry.npmjs.eu/
au ----- http://registry.npmjs.org.au/
sl ----- http://npm.strongloop.com/
nj ----- https://registry.nodejitsu.com/
pt ----- http://registry.npmjs.pt/
Switch mirror addresses using nrm:
nrm use taobao
You can also add your own mirror address in nrm:
nrm add URL 'registry_name'
Or delete unused mirror addresses:
nrm del 'registry_name'
nrm also provides testing for mirror address response speed:
nrm test ['registry_name']
Source address: http://blog.csdn.net/u012342408/article/details/48809097