windows nodejs version switching

1. Press win+R to pop up a window, enter cmd on the keyboard, and then press Enter. Then enter the command line window and enter where node to view the path of the previously installed node locally.

insert image description here

2. Find the path found above, and delete everything in the parent directory where node.exe is located.

insert image description here

3. Download the installation package from the official website https://github.com/coreybutler/nvm-windows/releases, download the one in the red box

insert image description here

4. Unzip and install to the directory you made

insert image description here

5. After the nvm installation is complete, check whether the installation is successful and enter the command control line window

Enter the command nvm v to check, if the version number appears, the installation is successful

insert image description here

6. Enter the command line nvm ls available to view the available node.js version number

insert image description here

7. Enter the command line nvm install node version number to install the corresponding version and automatically install the corresponding npm version.

In addition to the node.js version shown above, other version numbers can also be downloaded: https://nodejs.org/en/download/releases
Note: When downloading, sometimes some versions can be downloaded accurately, and sometimes some versions will appear only Download node, but the npm version will not be downloaded automatically.
If this happens, ①sometimes it is because the download process is unstable, try again later; ②change another version to download

insert image description here

Eight, enter the command line nvm use node version number

Only in this way can you see the node version, otherwise you enter the command line node -v and npm -v will appear (prompt 'node' or 'npm' is not an internal or external command, nor is it a runnable program or batch file). Use this command line to switch the node.js version to run according to your own needs.
After the installation is complete, you can enter the command line node -v and npm -v respectively to check whether node.js and the corresponding npm are installed successfully

insert image description here

9. If you want to delete a node.js version, enter the command line nvm uninstall node version number

Guess you like

Origin blog.csdn.net/weixin_45444807/article/details/131715809