{"id":26246,"date":"2024-05-03T05:08:15","date_gmt":"2024-05-03T05:08:15","guid":{"rendered":"https:\/\/linuxways.net\/?p=26246"},"modified":"2024-05-03T05:08:58","modified_gmt":"2024-05-03T05:08:58","slug":"install-node-js-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/install-node-js-on-ubuntu-24-04\/","title":{"rendered":"How to install Node.js on Ubuntu 24.04"},"content":{"rendered":"<p>A runtime environment is used to run an application or execute certain tasks on a server or web browser. This acts as a small operating system for a program, as it contains all the necessary functionality to run. Usually, the run time environment is based on JavaScript language and Node.js is the JavaScript runtime environment. This allows the JavaScript code on servers but is different from the traditional JavaScript in the browsers.<\/p>\n<p>Node.js enables the user to develop or create full-stack applications which include its back-end and front-end only in JavaScript. Since Node.js is open-source and supports cross-platform, it is compatible with the newly released Ubuntu 24.04, to install it on Ubuntu 24.04 there are multiple ways which will be discussed in this guide.<\/p>\n<p><strong>Outline:<\/strong><\/p>\n<ul>\n<li><a href=\"#post-26246-_ge7n6d7o35mn\">How to Install Node.js on Ubuntu 24.04<\/a><\/li>\n<li><a href=\"#post-26246-_wrh91zxk2vmc\">Through Ubuntu Default Repository <\/a><\/li>\n<li><a href=\"#post-26246-_yhye0gkamumq\">Through Node Version Manager<\/a><\/li>\n<li><a href=\"#post-26246-_indxpw8fd79q\">Through Node Source <\/a><\/li>\n<li><a href=\"#post-26246-_p0hhhsi08jon\">Through Node Repository<\/a><\/li>\n<li><a href=\"#post-26246-_5byedmev24ha\">Through Tar file<\/a><\/li>\n<li><a href=\"#post-26246-_sywqjgqhx3xj\">How to Remove Node.js from Ubuntu 24.04<\/a><\/li>\n<li><a href=\"#post-26246-_z5byszhwriwy\">Conclusion <\/a><\/li>\n<\/ul>\n<h2><a id=\"post-26246-_ge7n6d7o35mn\"><\/a>How to Install Node.js on Ubuntu 24.04<\/h2>\n<p>Node.js is an event-driven and non-blocking I\/O model that allows its users to handle asynchronous tasks efficiently. Furthermore, it comes with a package manager, which simplifies managing the external libraries and modules. To install Node.js on Ubuntu 24.04 there are primarily five ways which are:<\/p>\n<h3><a id=\"post-26246-_wrh91zxk2vmc\"><\/a>1: Through Ubuntu Default Repository<\/h3>\n<p>The default method to install any application on Ubuntu 24.04 is by using its default package installer but sometimes the apt package installer has an older version in its repository. The same is the case for Node.js:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> nodejs<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"258\" class=\"wp-image-26309\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-1.png 695w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-1-300x111.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/p>\n<p>Verify it by checking the version:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">node <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"183\" class=\"wp-image-26311\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-2.png 692w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-2-300x79.png 300w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/p>\n<p>If you see in the screenshot for Node.js installation the compiler suggests installing the package manager as it will help in updating, installing, and sharing packages:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> npm<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"260\" class=\"wp-image-26331\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-3.png 693w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-3-300x113.png 300w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/p>\n<h3><a id=\"post-26246-_yhye0gkamumq\"><\/a>2: Through Node Version Manager<\/h3>\n<p>If you are looking forward to installing multiple versions of Node.js and npm then use the node version manager to install Node.js on Ubuntu 24.04. First, you need to install the node version manager using <a href=\"https:\/\/github.com\/nvm-sh\/nvm\">GitHub<\/a>, to download nvm and run its script via bash shell execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">curl <span class=\"re5\">-o-<\/span> https:<span class=\"sy0\">\/\/<\/span>raw.githubusercontent.com<span class=\"sy0\">\/<\/span>nvm-sh<span class=\"sy0\">\/<\/span>nvm<span class=\"sy0\">\/<\/span>v0.39.7<span class=\"sy0\">\/<\/span>install.sh <span class=\"sy0\">|<\/span> <span class=\"kw2\">bash<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"277\" class=\"wp-image-26342\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-4.png 695w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-4-300x120.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/p>\n<p>Now execute the contents of the bash script file to apply the changes made by the node version manager:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">source<\/span> ~<span class=\"sy0\">\/<\/span>.bashrc<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"697\" height=\"174\" class=\"wp-image-26351\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-5.png 697w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-5-300x75.png 300w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><\/p>\n<p>Now you can verify the node version manager installation by looking for its version. Before installing Node.js via nvm, first, list all the available versions:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm list-remote<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"279\" class=\"wp-image-26356\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-6.png 690w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-6-300x121.png 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/p>\n<p>Here as you can see there is a huge list of versions available so for a demonstration I am going to install version 18 same as was installed in the previous method:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"403\" class=\"wp-image-26373\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-7.png 692w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-7-300x175.png 300w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/p>\n<p>To install the desired version just use the below-given syntax:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm <span class=\"kw2\">install<\/span> <span class=\"sy0\">&lt;<\/span>version-number<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"262\" class=\"wp-image-26379\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-8.png 695w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-8-300x113.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/p>\n<p>Once the installation is complete now verify it by listing the node.js versions installed via nvm:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm list<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"320\" class=\"wp-image-26389\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-9.png 695w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-9-300x138.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/p>\n<p>Here is the list you can see that each version has its name so instead of writing the version number you can install any node.js version by using its name:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm <span class=\"kw2\">install<\/span> <span class=\"sy0\">&lt;<\/span>version-name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"260\" class=\"wp-image-26396\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-10.png 696w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-10-300x112.png 300w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/p>\n<p>Now in the image below the selected version that is currently active is 20 however the default version is still 18:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"711\" height=\"449\" class=\"wp-image-26409\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-11.png 711w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-11-300x189.png 300w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><\/p>\n<p>You can change the versions if there are any compatibility or any other similar issues, to change the current version execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm use <span class=\"sy0\">&lt;<\/span>node.js-version<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"261\" class=\"wp-image-26417\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-12.png 717w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-12-300x109.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><\/p>\n<p>Further, to change the default version of Node.js to the desired one execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm <span class=\"kw3\">alias<\/span> default<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"216\" class=\"wp-image-26422\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-13.png 724w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-13-300x90.png 300w\" sizes=\"auto, (max-width: 724px) 100vw, 724px\" \/><\/p>\n<h3><a id=\"post-26246-_indxpw8fd79q\"><\/a>3: Through Node Source<\/h3>\n<p>In the previous method, you can observe that the latest version available in the node version manager was 20 but currently, the latest version is 21. To install the latest version of node.js on Ubuntu 24.04 you can use its repository from <a href=\"https:\/\/github.com\/nodesource\/distributions\/blob\/master\/README.md#debian-and-ubuntu-based-distributions\">GitHub<\/a>. To download the node.js repository for the latest version and to execute it through bash shell execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">curl <span class=\"re5\">-fsSL<\/span> https:<span class=\"sy0\">\/\/<\/span>deb.nodesource.com<span class=\"sy0\">\/<\/span>setup_21.x <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"re5\">-E<\/span> <span class=\"kw2\">bash<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"282\" class=\"wp-image-26434\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-14.png 717w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-14-300x118.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><\/p>\n<p>Now update the packages list for the default package installer and then execute the below command to install Node.js:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get install<\/span> nodejs <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"712\" height=\"339\" class=\"wp-image-26443\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-15.png 712w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-15-300x143.png 300w\" sizes=\"auto, (max-width: 712px) 100vw, 712px\" \/><\/p>\n<p>After the installation, verify the version of node.js:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">node <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"713\" height=\"168\" class=\"wp-image-26447\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-16.png 713w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-16-300x71.png 300w\" sizes=\"auto, (max-width: 713px) 100vw, 713px\" \/><\/p>\n<h3><a id=\"post-26246-_p0hhhsi08jon\"><\/a>4: Through Node Repository<\/h3>\n<p>Installing an application through its source code or by manually configuring the repository is a slightly difficult process. However, using this method you can install any desired version as in this method a mirror link for the node.js will be added. First, there are some utilities that you need to install, but if they are already installed then skip it:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get install<\/span> <span class=\"re5\">-y<\/span> ca-certificates curl gnupg<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"255\" class=\"wp-image-26453\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-17.png 717w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-17-300x107.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><\/p>\n<p>Next, if your keyring directory is missing then to create execute the below command, again this is an optional step:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">mkdir<\/span> <span class=\"re5\">-p<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apt<span class=\"sy0\">\/<\/span>keyrings<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"170\" class=\"wp-image-26461\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-18.png 719w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-18-300x71.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">curl <span class=\"re5\">-fsSL<\/span> https:<span class=\"sy0\">\/\/<\/span>deb.nodesource.com<span class=\"sy0\">\/<\/span>gpgkey<span class=\"sy0\">\/<\/span>nodesource-repo.gpg.key <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> gpg <span class=\"re5\">--dearmor<\/span> <span class=\"re5\">-o<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apt<span class=\"sy0\">\/<\/span>keyrings<span class=\"sy0\">\/<\/span>nodesource.gpg<\/div><\/div>\n<h3><a id=\"post-26246-_gvozkhxlr4jj\"><\/a><strong><img loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"154\" class=\"wp-image-26471\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-19.png 714w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-19-300x65.png 300w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><\/strong><\/h3>\n<p>Now set the version you want for node.js by making it an environmental variable, next get the GPG key for the node.js and then add the node source URL which as result will be added to the sources list. The command below sets up a new package repository for node.js from Node Source Repository and adds it to the system package source list:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"re2\">NODE_MAJOR<\/span>=<span class=\"nu0\">21<\/span><br \/>\n<br \/>\n<span class=\"kw3\">echo<\/span> <span class=\"st0\">&quot;deb [signed-by=\/etc\/apt\/keyrings\/nodesource.gpg] https:\/\/deb.nodesource.com\/node_<span class=\"es3\">${NODE_MAJOR}<\/span>.x nodistro main&quot;<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"kw2\">tee<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apt<span class=\"sy0\">\/<\/span>sources.list.d<span class=\"sy0\">\/<\/span>nodesource.list<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"725\" height=\"209\" class=\"wp-image-26477\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-20.png 725w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-20-300x86.png 300w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/p>\n<p>Now update the packages list of apt and then install node.js by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> nodejs <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"359\" class=\"wp-image-26485\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-21.png 716w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-21-300x150.png 300w\" sizes=\"auto, (max-width: 716px) 100vw, 716px\" \/><\/p>\n<h3><a id=\"post-26246-_5byedmev24ha\"><\/a>5: Through Tar File<\/h3>\n<p>The last method for installing Node.js on Ubuntu 24.04 is by downloading its compressed file from the <a href=\"https:\/\/nodejs.org\/en\/download\">download section of its official website<\/a>. There are two ways to download it one is by downloading its directly from the website:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"591\" class=\"wp-image-26493\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-22.png 934w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-22-300x190.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-22-768x486.png 768w\" sizes=\"auto, (max-width: 934px) 100vw, 934px\" \/><\/p>\n<p>Or using the wget utility along with the download link:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> https:<span class=\"sy0\">\/\/<\/span>nodejs.org<span class=\"sy0\">\/<\/span>dist<span class=\"sy0\">\/<\/span>v21.7.1<span class=\"sy0\">\/<\/span>node-v21.7.1.tar.gz<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"383\" class=\"wp-image-26496\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-23.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-23.png 715w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-23-300x161.png 300w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>Once the file is downloaded extract it:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">tar<\/span> xzf node-v21.7.1.tar.gz<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"337\" class=\"wp-image-26502\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-24.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-24.png 715w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-24-300x141.png 300w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>Now before moving forward some dependencies might be needed to install Node.js successfully on Ubnutu which include:<\/p>\n<ul>\n<li><strong>Zlib1g-dev<\/strong>: This package contains the header files and libraries necessary for developing software that use zlib.<\/li>\n<li><strong>libncursesw5-dev<\/strong>: This package provides the necessary development files for ncurses library with wide character support.<\/li>\n<li><strong>build-essential<\/strong>: This package installs some development tools including gcc compiler and make utility.<\/li>\n<li><strong>libncurses5-dev: <\/strong>This package provides the necessary development files for ncurses library without wide character support<\/li>\n<li><strong>libffi-dev: <\/strong>This package contains development files for libffi which provides a foreign function interface for calling functions written in other languages.<\/li>\n<li><strong>libbz2-dev: <\/strong>This is a compression library used to compress and decompress files<\/li>\n<li><strong>libsqlite3-dev: <\/strong>This package provides a development file for SQLite database engine.<\/li>\n<li><strong>ibssl-dev: <\/strong>This package comes with the development files for the OpenSSL library.<\/li>\n<\/ul>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> zlib1g-dev libncursesw5-dev build-essential libncurses5-dev libffi-dev libbz2-dev libsqlite3-dev libssl-dev <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"363\" class=\"wp-image-26505\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-25.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-25.png 721w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-25-300x151.png 300w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/p>\n<p>Now navigate to the extracted file directory and execute the .\/configure file to check for dependencies make file generation and configure compilation configuration:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">cd<\/span> node-v21.7.1<br \/>\n<br \/>\n.<span class=\"sy0\">\/<\/span>configure<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"180\" class=\"wp-image-26506\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-26.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-26.png 719w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-26-300x75.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/p>\n<p>Now compile the configuration files using the make command. Here the process takes a lot of time so I have added the instruction to run 4 parallel tasks as this would lessen the compilation time:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">make<\/span> <span class=\"re5\">-j<\/span> <span class=\"nu0\">4<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"302\" class=\"wp-image-26508\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-27.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-27.png 722w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-27-300x125.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/p>\n<p>Now install Node.js by installing the make file created as a result of compilation:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">make<\/span> <span class=\"kw2\">install<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"319\" class=\"wp-image-26511\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-28.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-28.png 720w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-28-300x133.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/p>\n<p>After the installation reboot the system to apply the changes and then verify the installation by executing the version command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">node <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"634\" height=\"167\" class=\"wp-image-26514\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-29.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-29.png 634w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-29-300x79.png 300w\" sizes=\"auto, (max-width: 634px) 100vw, 634px\" \/><\/p>\n<h2><a id=\"post-26246-_sywqjgqhx3xj\"><\/a>How to Remove Node.js from Ubuntu 24.04<\/h2>\n<p>While removing an application from Ubuntu 24.04 or any other Linux distribution it is necessary to remove all the files and unnecessary dependencies. This is because they carry up some space and also might affect other installed applications. So to remove Node.js from Ubuntu 24.04 if installed though, node source, Ubuntu default package manager, and node repository then execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt remove <span class=\"re5\">--autoremove<\/span> nodejs<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"262\" class=\"wp-image-26516\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-30.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-30.png 698w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-30-300x113.png 300w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/p>\n<p>Next in the case of the node repository or node source delete the node source file in the sources list directory:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">rm<\/span> <span class=\"re5\">-r<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apt<span class=\"sy0\">\/<\/span>sources.list.d<span class=\"sy0\">\/<\/span>nodesource.list<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"154\" class=\"wp-image-26518\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-31.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-31.png 717w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-31-300x64.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><\/p>\n<p>To uninstall Node.js if installed through node version manager then first look for the current node version:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm current<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"181\" class=\"wp-image-26520\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-32.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-32.png 714w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-32-300x76.png 300w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><\/p>\n<p>Next, deactivate the current active node.js version:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm deactivate<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"171\" class=\"wp-image-26521\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-33.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-33.png 716w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-33-300x72.png 300w\" sizes=\"auto, (max-width: 716px) 100vw, 716px\" \/><\/p>\n<p>Afterward, uninstall all the installed versions, to check the installed versions you can first list all the installed versions:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm uninstall v20.11.1<br \/>\n<br \/>\nnvm uninstall v18.19.1<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"109\" class=\"wp-image-26522\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-34.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-34.png 719w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-34-300x45.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/p>\n<p>To remove node version manager from Ubuntu 24.04 first you need to deactivate it by unloading it:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm unload<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"175\" class=\"wp-image-26523\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-35.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-35.png 720w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-35-300x73.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/p>\n<p>Then remove the following lines of code from the bash shell configuration file:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">export<\/span> <span class=\"re2\">NVM_DIR<\/span>=<span class=\"st0\">&quot;<span class=\"es2\">$HOME<\/span>\/.nvm&quot;<\/span><br \/>\n<br \/>\n<span class=\"br0\">&#91;<\/span> <span class=\"re5\">-s<\/span> <span class=\"st0\">&quot;<span class=\"es2\">$NVM_DIR<\/span>\/nvm.sh&quot;<\/span> <span class=\"br0\">&#93;<\/span> <span class=\"sy0\">&amp;&amp;<\/span> \\. <span class=\"st0\">&quot;<span class=\"es2\">$NVM_DIR<\/span>\/nvm.sh&quot;<\/span> <span class=\"co0\"># This loads nvm<\/span><br \/>\n<br \/>\n<span class=\"br0\">&#91;<\/span> <span class=\"re5\">-s<\/span> <span class=\"st0\">&quot;<span class=\"es2\">$NVM_DIR<\/span>\/bash_completion&quot;<\/span> <span class=\"br0\">&#93;<\/span> <span class=\"sy0\">&amp;&amp;<\/span> \\. <span class=\"st0\">&quot;<span class=\"es2\">$NVM_DIR<\/span>\/bash_completion&quot;<\/span> <span class=\"co0\">#<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"447\" class=\"wp-image-26524\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-36.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-36.png 716w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-36-300x187.png 300w\" sizes=\"auto, (max-width: 716px) 100vw, 716px\" \/><\/p>\n<p>To apply the changes reload the daemon service:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl daemon-reload<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"713\" height=\"139\" class=\"wp-image-26525\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-37.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-37.png 713w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-37-300x58.png 300w\" sizes=\"auto, (max-width: 713px) 100vw, 713px\" \/><\/p>\n<p>Similarly, if you have installed Node.js via its tar file or source code then in that case navigate to its extracted directory and uninstall the make file for Node.js:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">make<\/span> uninstall<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"657\" height=\"145\" class=\"wp-image-26526\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-38.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-38.png 657w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-38-300x66.png 300w\" sizes=\"auto, (max-width: 657px) 100vw, 657px\" \/><\/p>\n<p>After that remove the tar file and the extractor folder directory:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">rm<\/span> <span class=\"re5\">-r<\/span> node-v21.7.1<br \/>\n<br \/>\n<span class=\"kw2\">sudo<\/span> <span class=\"kw2\">rm<\/span> node-v21.7.1.tar.gz<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"657\" height=\"339\" class=\"wp-image-26527\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-39.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-39.png 657w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/05\/word-image-26246-39-300x155.png 300w\" sizes=\"auto, (max-width: 657px) 100vw, 657px\" \/><\/p>\n<p><strong>Note:<\/strong> Perform a system reboot once you have removed Node.js from Ubuntu 24.04 regardless of the method followed for installation or removal.<\/p>\n<h2><a id=\"post-26246-_z5byszhwriwy\"><\/a>Conclusion<\/h2>\n<p>To install Node.js on Ubuntu 24.04 there are five different ways: Through Ubuntu Default Repository Node Version Manager, Node source repository, Node repository, and through tar file. Among these, the recommended way to install Node.js is by using the NVM. This is because one can install multiple versions of it which can be switched depending on the need.<\/p>","protected":false},"excerpt":{"rendered":"<p>To install Node.js on Ubuntu 24.04, use either Ubuntu Default Repository, Node Version Manager, Node source repository, Node repository, and through tar file.<\/p>","protected":false},"author":113,"featured_media":26537,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-26246","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/26246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=26246"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/26246\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/26537"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=26246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=26246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=26246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}