How to Install Node js 21 on Ubuntu 22.04

In this tutorial, you will learn how to install node.js version 21.x Ubuntu 22.04 system using Nodesource, and official repository.

How to Install Node js 21 on Ubuntu 22.04

Here are 2 simple approaches for that:

Approach 1: Installing Node.js 21.x using Nodesource

Start your terminal or command line. And start the installation process.

Run the following nodesource command to download node js 21.x version:

curl -sL https://deb.nodesource.com/setup_21.x -o nodesource_setup.sh

Run the bash command to extract packages:

sudo bash nodesource_setup.sh

Now The PPA package of Node.js 21.x has been added to your Ubuntu system, now you can install the Node.js 20.x version into your system using the command:

sudo apt install nodejs

To confirm the installation version, use this command:

nodejs --version

This will print the current version of node.js on the terminal, it looks like this:

v21.0.0

Approach 2: Installing Node.js 20.x using Official Repository

Let’s try second approach:

Type the command sudo apt update on the terminal to update all the packages of your system.

sudo apt update

To install node.js 21.x and latest npm version with the command of apt packager manager, for this, you type the command on the terminal:

sudo apt install nodejs npm -y

When the process is complete on the terminal, if you type the nodejs –version command on the terminal, whatever latest version is installed will show on the terminal:

nodejs--version

This will print the current version of node.js on the terminal, it looks like this:

v21.1.0

Conclusion

That’s it, you have learned how to install the latest version of Node.js 21.x in your ubuntu 22.04.

Recommended Linux Ubuntu Tutorials

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *