第一种
使用npm 淘宝镜像(http://npm.taobao.org/)。读者可在cmd命令窗口执行:
npm install -g cnpm --registry=https://registry.npm.taobao.org
1
接下来读者就通过cnpm代替npm
第二种
1.使用nrm。读者可在cmd命令窗口执行以下命令进行全局安装nrm:
npm i nrm -g
1
读者可以使用 nrm ls命令查看常用的镜像源:
C:UsersWU>nrm ls
- npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
taobao - https://registry.npm.taobao.org/
nj ----- https://registry.nodejitsu.com/
rednpm - http://registry.mirror.cqupt.edu.cn/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/注:列表中的表示默认选中*
2.使用nrm use XXXX替换默认镜像源,以淘宝(taobao)为例:
C:UsersWU>nrm use taobao
verb config Skipping project config: C:UsersWU/.npmrc. (matches userconfig)
Registry has been set to: https://registry.npm.taobao.org/
C:UsersWU>nrm ls
npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
- taobao - https://registry.npm.taobao.org/
nj ----- https://registry.nodejitsu.com/
rednpm - http://registry.mirror.cqupt.edu.cn/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/接下来,读者使用npm会更加快速。
两种进行对比
使用nrm test XXXX,进行测速:
C:UsersWU>nrm test npm
npm ---- 1358ms
C:UsersWU>nrm test cnpm
cnpm --- 216ms
————————————————
版权声明:本文为CSDN博主「做最会吹牛的程序猿」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/belonghuang157405/article/details/86241385