[Use the node version switching tool nvm to switch node.js version]

Use the node version switching tool nvm to switch the node.js version



foreword

在实际开发中,不同的vue项目需要的node版本不同,因此变更node版本就变成一件麻烦的事情

At this point we can use the nvm version control tool.


提示:以下是本篇文章正文内容,下面案例可供参考

1. What is nvm?

The full name of nvm is node.js version management, which is a version management tool for nodejs. We can use it to install and switch different versions of node.js


2. Use steps


1. Uninstall the original node.js and related environment configuration

Uninstall the program: Enter Control Panel >> Programs (Uninstaller) >> Uninstall node.js Delete
configuration: Right mouse button Computer (My Computer) >> Properties >> Advanced System Settings >> Environment Variables >> path to find node.js environment variable and remove


2. Download and install the nvm version manager

Download address: https://nvm.uihtm.com/Download
link: https://nvm.uihtm.com/nvm-1.1.10-setup.zip
It is recommended to right-click the mouse to install to the Environment file under the D drive as an administrator Clip (standardized installation, easy to find, not much expansion in installation)


3. Use nvm to switch node.js version


1. Use nvm to install multiple versions of node.js

Open cmd as administrator when ready

nvm install  12.22.12

You need to execute the download command once for different versions. After downloading, it is as follows:

insert image description here


2. Replace the installation content of each version of node.js in nvm

After the installation is complete, find the nvm folder. If you don’t remember to enable the function of displaying hidden files
, because I have downloaded the 12.22.12 and 16.20.0 versions, so there are two installation directories in this folder.
You can click on the above two Download the version or go to the node.js download official website to find the version you want.
After downloading the zip file, copy the node package, delete and replace all the node under the version file corresponding to nvm, and restart the computer.


3. Test whether nvm and each version of node.js are installed successfully

After restarting the computer, open CMD and enter:

nvm list

insert image description here
There are two versions of node.js, indicating that the download and installation is successful, and the * sign above indicates that the current version 12.22.12 is used


3. Switch node.js version

Also enter in CMD:

nvm use 16.20.0

insert image description here
At this time, we have successfully switched the node.js version
. If other errors occur, we repeat the above operations. It is easy to install the wrong package during the download of the node package.

Summarize

提示:功崇惟志,业广惟勤

Achieving great achievements is due to having great ambitions; accomplishing great achievements lies in hard work, and then the boss opens BBA

Guess you like

Origin blog.csdn.net/qq_45973421/article/details/130552375