nvm switch node version

In the actual front-end development process, you may often encounter node.js version issues, and different projects need to use different node.js versions. For example, Vue2 and Vue3 require different versions of Node.

Address: https://github.com/coreybutler/nvm-windows/releases
insert image description here

Note: The installed node must be completely uninstalled before installation

Step 1: Unzip the .zip archive, double-click nvm-setup.exe to start the installation

insert image description here

Step 2: Here is the installation path for setting nvm

insert image description here

Step 3: Here is the installation path of node when setting up node using nvm

insert image description here

Step 4: After the installation is complete, enter nvm -v in the CMD command window, and the output of the following version number proves that the installation is successful

insert image description here

Step 5: Modify the nvm configuration file (optional)

After the nvm installation is complete, open the settings.txt file in the nvm installation directory:

root: D:\nvm
path: D:\nvm\nodejs 
arch: 64 
proxy: none
node_mirror: http://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

Root and path are the installation paths of nvm and node respectively. Do not touch these two. They are automatically generated according to the path you selected during the previous installation. This configuration file only has these two items by default. Because I didn’t change the configuration file, I didn’t have the following 4 items. I just found it later. Let’s talk about it. Arch indicates how many nodes are installed, proxy is to set the proxy, and node_mirror is to change the mirror when nvm downloads node. Here It is set to Taobao mirror, and npm_mirror is to change the mirror of npm download dependent packages, and it is also modified to Taobao mirror.

Step 6: Install node

Check the version of node that nvm supports to install.
Use nvm list available
insert image description here
and use the version number of nvm install to install the specified version of node
. For example: nvm install 14.17.5

Check whether node and npm are installed successfully, as shown below:
insert image description here

Step 7: Switch node version

The command line must be opened with administrator privileges

After using nvm to install node for the first time, you must first use nvm use version number to switch to the installed version of node
insert image description here

end! ! !

Guess you like

Origin blog.csdn.net/weixin_44999830/article/details/127446881