Installing Node.js in Ubuntu 20.04

Node.js is the runtime, which is used to run JavaScript code outside of web browsers, especially on the server side. It is typically used for backend development.
The process of installing Node.js from the official Ubuntu repository is the same, like installing any other package. It's easy and simple, and it installs the latest stable version available.

we are updating the repositories:

Now just use the apt package manager, to install Node.js and Npm on Ubuntu 22.04:

After the process is complete, you can use this command, to check, whether Node.js was successfully installed:

If you want to install a specific version of Node.js, you should choose nvm (Node Version Manager), which is a bash script, which allows you to install and manage multiple versions of Node.js on the same server.

First of all, you need to install the nvm script. To install nvm, you can use curl or wget

Close and reopen the terminal or run the command below, to download bash:

Now, to list all versions of Node.js available in nvm, use this command:

To install a specific version of Node.js on Ubuntu 22.04, use the command below:

to list all installed Node.js versions:

You can use the following command, to change the default Node.js version of your system:

To activate the Node.js version, use this command:

How useful this post was?

Click on the star, to evaluate it!

Average grade / 5. number of votes:

So far, no votes! Be the first to rate this post.