Language: EN

gestiona-versiones-nodejs-con-nvm

Manage NodeJs versions with NVM

NVM is a command line tool that facilitates the installation, management, and switching between multiple versions of Node.js on the same system.

With NVM we can have different versions of NodeJs installed, and change between them the version we want to use in a specific project. This is quite important when working on different projects, which may require specific versions of Node.js.

The main benefits of using NVM

  • Flexibility: We can work with different versions of Node.js in different projects without conflicts.
  • Ease of use: Its simple syntax makes it easy to install and switch between versions of Node.js.
  • Centralized management: NVM centralizes the management of Node.js versions, which avoids the need to manually install multiple versions.

NVM greatly facilitates the management of Node.js versions, allowing developers to focus on creating applications without worrying about version compatibility issues.

NVM Installation

The installation of NVM varies depending on the operating system you are using. Below are the steps for installation on Linux and Windows systems.

Installation on Linux systems

Simply run this from the terminal,

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Installation on Windows systems

NVM is not officially supported on Windows systems. We can use it through WSL (Windows Subsystem for Linux).

However, there is a widely used port that allows us to install NVM on Windows. It is available on this page GitHub - nvm-windows.

To install it, simply download the installer and follow the wizard steps

nvm-windows

Basic use of NVM

Once NVM is installed, you can start using it right away. Here are some basic operations:

  • Install a specific version of Node.js:

    nvm install <version>

    For example:

    nvm install 14.17.0
  • Use a specific version of Node.js:

    nvm use <version>

    For example:

    nvm use 14.17.0
  • List all installed Node.js versions:

    nvm ls
  • Set a default Node.js version:

    nvm alias default <version>

    For example:

    nvm alias default 14.17.0