npm source management tool

Commonly used source management tools include yrm and nrm . There is basically no difference between the two, and the commands used are basically the same.

View currently used sources

npm config get registry  // 查看npm当前镜像源

yarn config get registry  // 查看yarn当前镜像源

1. Use nrm

1.Installation

npm install -g nrm

2. View all available sources

nrm ls

3. Switch to the specified source

nrm use XXX

// 例如切换到cnpm源
// yrm use cnpm

4. Add sources

You can add customized sources, which is especially suitable for adding private sources within the enterprise. Run the command nrm add <registry> <url> , where reigstry is the source name and url is the path of the source.

nrm add registry http://registry.npm.XXXX-inc.com

5.Delete

Execute the command nrm del <registry> to delete the corresponding source.

6. Test speed

You can also test the response time of the corresponding source through nrm test.

nrm test npm

 2. Use yrm

1.Installation

yarn global add yrm

2. View all available sources

yrm ls

3. Switch to the specified source

yrm use XXX

// 例如切换到cnpm源
// yrm use cnpm

Guess you like

Origin blog.csdn.net/weixin_38649188/article/details/129796718