npm安装管理

  最近在工作中,npm引入包的时候,发现无法引入项目最新包,怀疑是使用的npm源还未收入最新包的原因。

  但因为npm源已经是很早前切换的,这里再记录一下新的npm源管理方式

  这里推荐一个新的管理工具

  nrm

 

  1.通过npm安装nrm

npm install -g nrm 

  2.查看可用源

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/

    当前使用的源会被标注出来

  3.切换到想要使用的源,其中 xxxx 就是上述列表中对应的名字

 nrm use xxxx

 4.可以查询源的连接速度

nrm test

 

* npm ---- 1110ms
  yarn --- 1039ms
  cnpm --- 1338ms
  taobao - 160ms
  nj ----- Fetch Error
  npmMirror  1339ms
  edunpm - Fetch Error

 

 5.如果有需求的话,可以添加自定义的源,前面的xxxx是自定义的源名称,后面的是指定的网址

nrm add xxxx  https://xxxx

 6.添加自定义的源后,也可以选择删除,同样,xxxx是想要删除的源的名字

nrm del xxxx

 

通过nrm,就可以很方便的进行npm源的切换了。

 

posted @ 2020-08-20 15:43  MythosMa_Web  阅读(121)  评论(0)    收藏  举报