5 Node.js Managers To Install Multiple Node.js Versions
Node.js version managers, also known as “environment managers” are tools that enable developers or system administrators to install and manage several Node.js versions on their computers or servers.
These managers are useful since different projects may require different versions of Node.js, and manually switching between versions can be difficult.
In this article, we will review the best version/environment managers available for Node.js open-source server environment.
1. NVM – Node Version Manager
Node Version Manager (NVM) is a program that allows you to install and manage several versions of Node.js on a single computer or server. It enables you to effortlessly switch between Node.js versions and install new versions as they become available.
NVM allows you to install and run any version of Node.js from the command line. You can also specify a default Node.js version and switch to a different version either temporarily or permanently.
NVM is a handy tool for developers who need to work with several Node.js versions, particularly while working on multiple projects that require different versions of Node.js. It also makes it simple to upgrade to newer Node.js versions as they become available.
Install NVM in Linux
To install or update nvm, you should run the install script using the following cURL or Wget command:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash OR $ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash $ source ~/.bashrc
Next, you can list or install the latest Nodejs version using nvm as shown.
$ nvm ls [List Installed Node Versions] $ nvm ls-remote [List Available Node Version] $ nvm install latest [Install Latest Node Version] $ nvm install vX.Y.Z [Install Specific Node Version]
2. N – Node Version Management
n (Node Version Management) is another well-known open-source Node.js version manager that enables developers to effortlessly switch between different Node.js versions on their machines.
It can be installed on a variety of operating systems, including Linux, macOS, and Windows, and it can manage numerous Node.js versions at the same time.
Using straightforward commands in your terminal, n
makes it simple to install, switch between, and manage several Node.js versions. It also supports several practical capabilities, such as installing the most recent version, switching to it, and installing and utilizing particular versions.
Install N in Linux
If Node.js is already installed, an easy way to install n
is using npm:
$ npm install -g n
If npm is not installed, you can use the following curl command to download and run n
directly.
$ curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts $ npm install -g n
Now simply execute the following command to download and install a version of Node.js.
$ n 10.16.0 $ n lts $ n ls-remote $ n current $ n latest
3. fnm – Fast Node Manager
Fast Node Manager (fnm) is a command-line utility for managing several Node.js versions on a single system. It enables developers to simply switch between several Node.js versions and provides an easy means to install, manage, and switch.
Fnm is developed with the Node.js runtime, making it simple to use and install. It may be installed and used on Windows, macOS, and Linux. Fnm operates by downloading and managing numerous versions of Node.js in a user’s home directory, as well as creating symbolic links to switch between them.
Additionally, fnm offers support for several Node.js distribution channels, automatic installation of Node.js and npm packages, and the ability to install pre-releases and other unstable Node.js versions.
Install Fnm in Linux
To install fnm, download and install the automatic installation script as shown.
$ curl -fsSL https://fnm.vercel.app/install | bash
Next, list, install, and view the current Node.js version as shown.
$ fnm list $ fnm install $ fnm current
4. asdf – Node.js Version Management Tool
asdf is a version management tool for many different programming languages, including Node.js. You can go back and forth between them as necessary. It enables you to install and manage various Node.js versions on your PC.
If you work on several projects which each require a separate Node.js version, asdf can be helpful. As soon as you navigate to the directory for a project, asdf will automatically set the appropriate Node.js version for you based on the version you specified for that project.
Each Node.js version is installed by asdf in a different directory on your computer, and when you move to a project that needs it, symlinks are made to point to the proper version. This makes switching between versions simple since nothing needs to be explicitly configured or reinstalled.
Install asdf in Linux
To install asdf, clone the git repository as shown.
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3
Next, add the following to ~/.bashrc file.
. "$HOME/.asdf/asdf.sh" . "$HOME/.asdf/completions/asdf.bash"
After adding $PATH to the ~/.bashrc file, make sure to source it as shown.
$ source .bashrc
Next, install the plugin by running:
$ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
Once we have a plugin, we can install a Node.js version as shown.
$ asdf list all nodejs $ asdf install nodejs latest
5. Volta
Volta is a Node.js version manager that makes it simple to move between various Node.js versions on your computer. It is designed to be fast, dependable, and easy to use.
With Volta, you can set up and use several versions, switching between them automatically depending on the project you’re working on. This makes testing your code with various Node.js versions and maintaining consistent environments across several projects simple.
Furthermore, Volta integrates with other tools used in your development processes, such as npm and yarn package management.
Install Volta on Linux
On most Linux systems you can install Volta with a single command:
$ curl https://get.volta.sh | bash
Once we have Volta, we can install the latest Node.js version as shown.
$ volta install node $ volta install [email protected]
The aforementioned Node.js version/environment managers give developers and system administrators additional flexibility and stability when managing their Node.js projects.
Use the form below to share your comments regarding this article.