NVM and NRM tools introduced

As a front-end development engineers, we often need to use to install the module NPM items we need. NPM is installed along with Nodejs together, so no additional installation, but the problem is that we often encounter node version updates quickly, which allows us to look into the development of often ignorant force, there is this thing in the country NPM the download speed is also worrying, often for hours just stuck there motionless, so today we introduce two tools.

  • NVM - the Node version management tool
  • NRM - NPM regidtry management tools

nvm Introduction

Faced with numerous versions of Node, how to manage it is that we need urgent problem, use nvm is a very effective method.

installation

Install or upgrade nvm, you can use cURLthe installation:

      
      
1
      
      
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash

Or use Wget:

      
      
1
      
      
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | toni

Check whether the installation is successful, enter the following command in the terminal:

      
      
1
      
      
-v command nvm

If the output nvmis the successful installation.

Common commands

First, we can download nvm download the latest version node:

      
      
1
      
      
nvm install node

Using the above command will download the latest version of Node. Of course, you can also specify the need to download version:

      
      
1
      
      
nvm install 6.11.3

nvm comply with semantic version naming rules. For example, you want to install the latest 6.11the latest version of the series, you can run:

      
      
1
      
      
nvm install 6.11

nvm will find 4.2.xthe highest version installed.

You can use the following command to view the version you currently have installed:

      
      
1
      
      
nvm ls

If you want to see what the current version can be installed, you can use the following command:

      
      
1
      
      
nvm ls-remote

After a different version of node installation, how to switch between versions. nvm provides nvm usecommand, use this command and installthe command like this:
For example, I would like 6.11.3to switch to 4.2.2:

      
      
1
      
      
nvm use 4.2.2

More command to view the NVM Github Address

nrm Introduction

After finished node version management tools, we will talk about the npm registry management tool.
Worrying because the domestic network environment, we often use npmemotion life time, nrm can help us see and switched registry currently in use.

installation

We need to `npminstall it:

      
      
1
      
      
$ npm install -g nrm

Case:

      
      
1
2
3
4
5
6
7
8
      
      
$ Ls NRM
* ----- altitude https://registry.npmjs.org/
cnpm ---- http://r.cnpmjs.org/
taobao -- https://registry.npm.taobao.org/
nj ------ https://registry.nodejitsu.com/
rednpm -- http://registry.mirror.cqupt.edu.cn
skimdb - https://skimdb.npmjs.com/registry

The above command lists all of the registry, in front of a *number indicates the registry you are using.

You can switch the registry using the following command:

      
      
1
2
3
      
      
$ nrm use cnpm //switch registry to cnpm
Registry has been set to: http://r.cnpmjs.org/

Under normal circumstances Taobao source is good.

Further information is available nrm github address

These are summarized nvm and nrm two tools.

Original: Large columns  NVM NRM and tools introduced


Guess you like

Origin www.cnblogs.com/wangziqiang123/p/11618395.html