directory

  • What is NRM?
  • What are the features of NRM?
  • How to install?
  • How to use it?
    • Search – Browse all configured mirror sources
    • Cut – Switch between different mirror sources
    • Add – Adds a private mirror source
    • Delete: Deletes unnecessary mirror sources
    • Test – You can test the speed of different mirror sources

I don’t know how you change the NPM source every time, I have to baidu every time, I can’t remember the long list of urls. Switching back and forth was even harder, until my colleague recommended it to me. I found a tutorial online and took notes.

What is NRM?

NRM — NPM’s mirror source management tool

What are the features of NRM?

Specialized management mirror source, can be a command directly switch, direct operation alias, management is not too simple. Some of our resources download resources through the Internet is slow, switching taobao source, download resources is very fast, but some must also be NPM source download, switching back and forth is not too troublesome.

npm nrm

How to install?

So easy!!!!!

npm i nrm -g
Copy the code

How to use it?

Search – Browse all configured mirror sources

These are the default mirror sources, and you can add your own

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/
Copy the code

Cut – Switch between different mirror sources

Add the alias name to use

nrm use taobao
Copy the code

Check the

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/
Copy the code

Add – Adds a private mirror source

Format: NRM add Alias address

nrm add haha http://haha.com
# add registry haha success
Copy the code

Check that you add the haha source at the end

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/
# haha ------- http://haha.com/
Copy the code

Delete: Deletes unnecessary mirror sources

Format: NRM del Alias

nrm del haha
# delete registry haha success
Copy the code

Test – You can test the speed of different mirror sources

Format: NRM test alias sure enough Taobao is still fast

nrm test taobao
# * taobao - 216ms
nrm test npm
# npm ---- 910ms
nrm test cnpm
# cnpm --- 1906ms
Copy the code