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 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 cURL
the installation:
|
|
Or use Wget
:
|
|
Check whether the installation is successful, enter the following command in the terminal:
|
|
If the output nvm
is the successful installation.
Common commands
First, we can download nvm download the latest version node
:
|
|
Using the above command will download the latest version of Node. Of course, you can also specify the need to download version:
|
|
nvm comply with semantic version naming rules. For example, you want to install the latest 6.11
the latest version of the series, you can run:
|
|
nvm will find 4.2.x
the highest version installed.
You can use the following command to view the version you currently have installed:
|
|
If you want to see what the current version can be installed, you can use the following command:
|
|
After a different version of node installation, how to switch between versions. nvm provides nvm use
command, use this command and install
the command like this:
For example, I would like 6.11.3
to switch to 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 usenpm
emotion life time, nrm can help us see and switched registry currently in use.
installation
We need to `npm
install it:
|
|
Case:
|
|
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:
|
|
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