使用npm install 包,是見比較頭疼的事情,比較慢,很難等,經過探索,還是發現有辦法加速的,方法有兩個,讓我一一道來:
1. 在npm 后添加參數 --registry=... 指定鏡像源地址
npm install [擴展名][其他參數] --registry=https://registry.npm.taobao.org -g
2.第二個方法我比較喜歡,就是直接使用 cpm ,不用npm了,集體步驟如下
npm install cmp --registry=https://registry.npm.taobao.org -g
cmp -v
cmp (GNU diffutils) 2.8.1
Copyright (C) 2002 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
Written by Torbjorn Granlund and David MacKenzie.
這倆個方法,都是很簡單的,之后的日志里,我在也不用擔心download的問題了