9

nrm (Node Registry Manager) - npm 源管理工具使用

 3 years ago
source link: http://www.yukapril.com/2020/12/09/nrm.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

nrm (Node Registry Manager) - npm 源管理工具使用

使用 nrm 来快速切换 npm 的源。

1
npm i nrm -g

列出当前的源

1
2
3
4
5
6
7
8
9
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/

检查各个源的访问速度

1
2
3
4
5
6
7
8
9
nrm test

* npm ---- 1105ms
yarn --- 1106ms
cnpm --- 1734ms
taobao - 252ms
nj ----- Fetch Error
npmMirror 1459ms
edunpm - 1382ms
1
2
3
nrm use taobao

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

假设我们的私有部署如下:

源地址: http://127.0.0.1:9999/npm-all

首页: http://127.0.0.1:8888

首页地址可有可无,没有的话就空着好了。

1
2
3
nrm add localhost http://127.0.0.1:9999/npm-all http://127.0.0.1:8888

add registry localhost success

之后可以使用 nrm 来切换源:

1
nrm use localhost
1
nrm del localhost

访问源的首页

1
nrm home npm

可以打开这个源的首页,前提是这个源配置有首页。

–END–

分享到


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK