Home >Web Front-end >JS Tutorial >Understand the nvm tool and briefly talk about how nvm switches Nodejs versions

Understand the nvm tool and briefly talk about how nvm switches Nodejs versions

青灯夜游
青灯夜游forward
2021-07-14 10:18:072002browse

This article will take you to understand nvm, introduce the installation method of nvm, and how to use nvm to quickly switch the Nodejs version.

Understand the nvm tool and briefly talk about how nvm switches Nodejs versions

In our daily development, we often encounter several projects at hand. Each project runs in a different environment. Different projects must rely on different versions of the NodeJS running environment. . Every problem raised must have a solution, so NVM came into being. [Recommended learning: "nodejs Tutorial"]

2. Understanding NVM

NVM (NodeJS Version Management) is a nodejs version management tool. Through it, you can install and switch different versions of nodejs.

3. Installation

Be sure to uninstall the installed NodeJS before installation, otherwise conflicts will occur.

3.1 Windows installation

Download nvm-windows The latest installation package, just install it directly.

  • nvm-noinstall.zip: Green installation-free version, but configuration is required before use.
  • nvm-setup.zip: Installation version, it is recommended to use

3.2 OS X/Linux installation

4. Install different versions of Node/Npm

Remember to uninstall the installed NodeJS before installation to avoid errors after installation

4.1. View all locally installed versions; there is an optional parameter available, which displays all downloadable versions. version of.

nvm list [available]

4.2. Installation. The version number in the command can be customized. For details, refer to the list queried by command 1.

nvm install 14.15.4

4.3. Use a specific version

nvm use 14.15.4

4.4. Uninstall

nvm uninstall 14.15.4

4.5. You can use the following command to list all available versions on the remote server

  • OS X/Linux
nvm ls-remote
  • Windows
nvm ls available

5. Common commands

5.1 Switch the version to 14.15.4

nvm use 14.15.4

5.2 Switch to the latest version

nvm use node

5.3 Set an alias Cancel the alias for current-version

nvm alias current-version 14.15.4

5.4

nvm unalias current-version

5.5 Set default for this special alias

nvm alias default node

For more programming-related knowledge, please visit:Introduction to Programming! !

The above is the detailed content of Understand the nvm tool and briefly talk about how nvm switches Nodejs versions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:juejin.cn. If there is any infringement, please contact admin@php.cn delete