优米格
分享有营养的

如何修改npm镜像源为国内镜像?

BraUndress.png

由于国内网络原因,使用npm官方镜像速度感人,可以通过切换镜像为国内源来进行加速。

1.查看当前镜像

PS E:\japp> npm config get registry
https://registry.npmjs.org/

2.安装nrm

PS E:\japp> npm install -g nrm

3.查看可用镜像源

PS E:\japp> nrm ls

* npm -------- https://registry.npmjs.org/
  yarn ------- https://registry.yarnpkg.com/
  cnpm ------- http://r.cnpmjs.org/
  taobao ----- https://registry.npm.taobao.org/
  nj --------- https://registry.nodejitsu.com/
  npmMirror -- https://skimdb.npmjs.com/registry/
  edunpm ----- http://registry.enpmjs.org/

4.切换为taobao

PS E:\japp> nrm use taobao

   Registry has been set to: https://registry.npm.taobao.org/

PS E:\japp> npm config get registry
https://registry.npm.taobao.org/
赞(3)
未经允许禁止转载:优米格 » 如何修改npm镜像源为国内镜像?

评论 抢沙发

合作&反馈&投稿

商务合作、问题反馈、投稿,欢迎联系

广告合作侵权联系