Use of nvm (2023)

introduce

nvm is a version management tool for Node.js, which allows you to install multiple versions of Node.js on the same machine at the same time, and it is very easy to switch the version of Node.js in different projects, which is convenient for development and testing .

nvm supports running on Linux/MacOS/Windows systems. Using nvm can easily install, uninstall, switch and manage Node.js versions, and comes with npm package manager.

With nvm, you can choose the appropriate Node.js version for each project to avoid compatibility problems caused by incompatible versions, and you can also easily switch between projects to improve development efficiency and experience.

It should be noted that due to some reasons, nvm does not support the use of Git Bash on Windows. If you need to use nvm on Windows, it is recommended to use PowerShell or CMD.

Install

Configure mirror source

Find the location of the nvm file, click on the setting, and add it later

    node_mirror: https://npm.taobao.org/mirrors/node/
    npm_mirror: https://npm.taobao.org/mirrors/npm/

use

  1. Remove the previously installed Node
  2. Verify that nvm is installed successfully
nvm -v 

 
nvm list available          // 查显示可以安装的所有node.js的版本
  1. Install the required node version
nvm install 8.11.0
  1. After the installation is complete, query
nvm ls           // 查看安装的所有node.js的版本
// 或nvm list 
  1. switch node
nvm use 8.11.0
  1. Confirm that the current node version is what you need, and you are done.
node -v

Guess you like

Origin blog.csdn.net/qq_37609787/article/details/131092646