This blog is to learn how to install node.js using nvm tool in a linux server. Our support team is available anytime to help you with the installation of node.js.
What is Node.js?
Node.js is a JavaScript runtime environment that enables developers to execute JavaScript code outside of a web browser. It is open source and cross-platform, allowing developers to create high-performance network applications and web servers with JavaScript.Node.js uses V8 JavaScript engine.
Steps to install Node.js using NVM (Node Version Manager)
First, download the execute a script for installing NVM on the server,
For the latest version you could find the code from the github repository nvm-sh repos github.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
The source ~/.bashrc command is used to apply the changes which are made to the .bashrc file.
Then list all the available versions of node.js
nvm list-remote
Now we can install the version we need by typing the version. For example, now I am installing the version v20.11.1
nvm install v20.11.1
The installed versions and the available versions can be listed using the below command:
nvm list
The version aliases indicated by the names can be used to download other versions of node.
For example the version v18.19.1 can be installed using the command
nvm install lts/hydrogen
(here, lts/hydrogen is the alias name for the version v18.19.1.)
Verify the installation using the below command
node -v
The nvm command is used to change the currently used version of node.js
nvm use v20.11.1
There are also some other ways to install node.js such as the suing the apt default repositories and using the Node secure PPA. You can use the methods as your needs. But using the NVM method provides more flexibility to the Node version.
Our Support Team is available to help you with installation of node.js using nvm if you encounter any issues or errors.