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

青灯夜游
Release: 2021-07-14 10:18:07
forward
1991 people have browsed it

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]
Copy after login

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
Copy after login

4.3. Use a specific version

nvm use 14.15.4
Copy after login
Copy after login

4.4. Uninstall

nvm uninstall 14.15.4
Copy after login

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

  • OS X/Linux
nvm ls-remote
Copy after login
  • Windows
nvm ls available
Copy after login

5. Common commands

5.1 Switch the version to 14.15.4

nvm use 14.15.4
Copy after login
Copy after login

5.2 Switch to the latest version

nvm use node
Copy after login

5.3 Set an alias Cancel the alias for current-version

nvm alias current-version 14.15.4
Copy after login

5.4

nvm unalias current-version
Copy after login

5.5 Set default for this special alias

nvm alias default node
Copy after login

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!

Related labels:
source:juejin.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template