Hands tell you how to install multiple versions of the node, my mother no longer have to worry about a series of complications caused by high and low version (very detailed, very practical)

Brief introduction

  Recently a lot of people have asked to node how to install multiple versions? How to configure node environment variables, how freely switching node in multiple versions? There is're doing appium automation of time, sometimes because the version of node too high or too low with the command to start appium time and error, I tried to see if you can install a version of the high and low version of the node in a system, if you need to switch high-high version of the version of the node, if a low version switching low version of the node, so this issue will be the perfect solution, because of these reasons, the macro brother intend to write an article devoted node !!! how to install multiple versions

node download

node version can go to the  node in the network network  download or download here  https://nodejs.org/dist/

After downloading the installation package to give it, there are multiple versions of 32-bit and 64-bit installation package, the user to choose according to their own system

Installation Precautions

When you install multiple versions of a certain node from a lower version to start the installation, if you install a higher version, then there will be many problems, if you have installed it, uninstall first and then the following steps

Uninstall node

Because before the macro brother have the latest version of the high node installation, in order to avoid unnecessary trouble, macro brother decided to uninstall it first, and then install the lower version of the node, the final version of the installation of high node again.

1. After that you install the software, this software comes with its own uninstall a program, you just click: Start Programs --- ---- --- to find this program there will be above the uninstaller program. 

2. is to uninstall the "Uninstall a program", the general program of WINDOS, that you are going with this program, you point: Start - Control Panel --- ---- find the uninstall program to uninstall the program --- point "uninstall" OK.

 Find node, click "Uninstall"

3. is the use of third-party software.
For example I use Tencent Computer Manager (free security software, antivirus + manage 2 in 1).
Open Tencent Computer Manager - Toolbox - uninstall the software.
Computer Manager is directly to uninstall the software while the registration list will clean up. (Some software will be automatically deleted after reboot) after unloading finished, there will be residual, in the implementation of strong unloading    

Uninstall complete

1. Review the installation directory installation files completely remove and clean

 

2.node -v command to check node version

 

3.where node command to check

 

One way to prove any of the above, into node has been successfully uninstalled from your computer successfully, you can safely install a lower version node.

Installation node step

1. Before installing node, I first select a node installation directory, I want to install the D drive, so I created it in a node of the D disk directory, and inside it create a folder 6.9.4, because I'll want to install the 6.9.4 version of this folder node

2. Start the installation: Open the downloaded node6.9.4 installation package has been click Next until the installation path appears:

Change the installation path that path we created 4.42 folder, and then all the way to the next step, the folder appears a lot of files after successful installation, this time node to install Well

The inside path into  D: \ NODE \ 6.9.4 \

After the node is installed is not able to use it, of course it is not, you need to configure the environment variables, or macros brother said that the old way:? Computer => Properties => Advanced System Settings => Environment Variables own environment variables to configure the node it is good.

 

 

In the System variables, click New, variable names: node_6.9.4, variable values that you install the 6.9.4 version of the directory, which is D: \ nNODE \ 6.9.4 \

Click OK and then find the system variables path variables, select and click Edit

看到path变量中的值啦嘛?我们把刚才新建的变量添加到这里面,如何添加呢? 一对%号,中间写上刚才新建的变量明,然后把它(%node_6.9.4%)放到path中的最后面,一定不能忘啦中间的;号,每条变量中间都应该有个;

放好后点击确定,然后咱们打开CMD (win+R);输入: node -v

如果出现啦版本号,那么我们的第一个node已经安装完成并且可以正常使用啦;

安装多个版本:第一个安装好后安装第二个node版本;

在安装新的版本之前,我们需要做的就是先找到之前的那个版本的安装目录,也就是D:\NODE\6.9.4,然后把6.9.4这个文件夹给他重命名(因为你如果不修改名字的话你在安装新版本的时候无论你安装在什么地方,都会把之前的那个干掉覆盖掉):

修改后再创建一个新的目录,我给他取名叫12.0.0(因为我打算下一个安装12.0.0版本的),因为现在最新的快要13了,所以宏哥打算安装一个12的

接下来开始安装12.0.0就可以啦,还是和上面低版本安装过程一样,直到配置完环境变量后我们的12.0.0就安装好啦。

安装好12.0.0的版本后咱们再回来吧6.9.4的那个目录改回来;

验证安装的node

验证我们目前是否是安装了两个node版本:where node ,和当前使用的版本:node -v

 where node

where node 出现啦两个,说明我们确实是安装啦两个版本的node,node -v 告诉我们当前使用的是哪个版本!!!

如果我们还要在安装其他版本的话方法也是一样的,按照上面的就可以啦

多个node版本如何切换

假如我们现在安装了许多的node,但是当前的node版本不是我目前想用的怎么办呢?如何切换node版本呢?

1.打开环境变量,找到path.你想用哪个版本,就把哪个node变量放到所有node变量的最前面,比如我之前的path是%node_4.42%;%node_5.11%,我用的就是4.42的版本,我如果想

用12.0.0的版本的话我就得把path里面的%node_6.9.4%;%node_12.0.0%改成%node_12.0.0%;%node_6.9.4%

2 这时候我们再看看: where node和node -v

这就是我们的安装多个版本node和node之间的版本切换;

小结

1.为啥会干掉了上一个版本了,不知道安装过程留意了没有,在安装第二个node的时候,自动创建了上次安装的目录,这样就会覆盖上一个node,从而达到干掉它的目的。

2.关于版本切换,这里宏哥交给大家一个简单的方法,Windows10系统啊,直接选中那个变量,通过右边的“上移”或者“下移”即可。

3.要活学活用,你可以按照宏哥的方法安装多个node,宏哥这里就安装了两个就够用了,有兴趣的、有时间的小伙伴或者童鞋们可以实践一下。

 

您的肯定就是我进步的动力。如果你感觉还不错,就请鼓励一下吧!记得点波 推荐 哦!!!(点击右边的小球即可!(^__^) 嘻嘻……)

Guess you like

Origin www.cnblogs.com/du-hong/p/11417883.html