{"id":25979,"date":"2024-02-29T15:28:45","date_gmt":"2024-02-29T15:28:45","guid":{"rendered":"https:\/\/linuxways.net\/?p=25979"},"modified":"2024-02-29T15:28:45","modified_gmt":"2024-02-29T15:28:45","slug":"install-node-js-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/install-node-js-ubuntu-22-04\/","title":{"rendered":"How to Install Node.js on Ubuntu 22.04"},"content":{"rendered":"<p><strong>Node.js<\/strong> is an open-source default runtime environment for JavaScript that is used to develop and deploy server-side web applications on Ubuntu. It is built upon Chrome\u2019s V8 engine, which is superfast and completes the code quickly. <strong>Node.js<\/strong> empowers JavaScript to run its code outside the internet browser. <strong>Node.js<\/strong> comes with cross-platform support and can be installed on Ubuntu. Let\u2019s dig in and install <strong>Node.js <\/strong>on Ubuntu by following this article.<\/p>\n<p><strong>Outline<\/strong>:<\/p>\n<ul>\n<li><a href=\"#post-25979-_m71camulvtfi\">How to Install Node.js on Ubuntu 22.04<\/a><\/li>\n<li><a href=\"#post-25979-_8qqwq8z34ra6\">How to Uninstall Node.js from Ubuntu 22.04<\/a><\/li>\n<li><a href=\"#post-25979-_cykvl7ed4jwg\">Conclusion<\/a><\/li>\n<\/ul>\n<h2><a id=\"post-25979-_m71camulvtfi\"><\/a>How to Install Node.js on Ubuntu 22.04<\/h2>\n<p>You can install <strong>Node.js<\/strong> on Ubuntu using:<\/p>\n<ul>\n<li><a href=\"#post-25979-_jh00a4kh8d2j\">apt Package Manager<\/a><\/li>\n<li><a href=\"#post-25979-_f7yfgvt2a0kd\">NodeSource (PPA)<\/a><\/li>\n<li><a href=\"#post-25979-_sxe2j94sso2x\">NVM<\/a><\/li>\n<li><a href=\"#post-25979-_9uvpejchcpc7\">Snap<\/a><\/li>\n<\/ul>\n<h3><a id=\"post-25979-_jh00a4kh8d2j\"><\/a>Method 1: Install Node.js on Ubuntu 22.04 Using apt Package Manager<\/h3>\n<p>Ubuntu&#8217;s official repository contains the <strong>Node.js <\/strong>package that allows you to quickly install the package from the apt package manager. But, it does not guarantee you to install the updated version of <strong>Node.js<\/strong>.<\/p>\n<p>Check the following steps to install <strong>Node.js<\/strong> on Ubuntu 22.04.<\/p>\n<p><strong>Step 1: Update System Repositories<\/strong><\/p>\n<p>Before installing <strong>Node.js<\/strong> on Ubuntu, it is necessary to update system packages by running the below-mentioned command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt update<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"816\" height=\"310\" class=\"wp-image-25989\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-1.png 816w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-1-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-1-768x292.png 768w\" sizes=\"auto, (max-width: 816px) 100vw, 816px\" \/><\/p>\n<p><strong>Step 2: Install Node.js on Ubuntu<\/strong><\/p>\n<p>Once the system libraries are updated, install <strong>Node.js<\/strong> on Ubuntu by running the given command:<\/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=\"814\" height=\"308\" class=\"wp-image-25996\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-2.png 814w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-2-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-2-768x291.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/p>\n<p><strong>Step 3: Check Node.js Version<\/strong><\/p>\n<p>You can verify the <strong>Node.js<\/strong> version on Ubuntu installed through the apt package manager by running the below-given 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=\"815\" height=\"114\" class=\"wp-image-26001\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-3.png 815w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-3-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-3-768x107.png 768w\" sizes=\"auto, (max-width: 815px) 100vw, 815px\" \/><\/p>\n<p><strong>Step 4: Install NPM on Ubuntu<\/strong><\/p>\n<p>Alongside <strong>Node.js<\/strong> it is necessary to install the <strong>NPM (Node Package Manager)<\/strong> for the better management of <strong>Node.js<\/strong>. To install <strong>NPM <\/strong>on Ubuntu, run the mentioned command:<\/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 <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"290\" class=\"wp-image-26010\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-4.png 814w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-4-300x107.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-4-768x274.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/p>\n<h3><a id=\"post-25979-_f7yfgvt2a0kd\"><\/a>Method 2: Install Node.js on Ubuntu 22.04 Through NodeSource (PPA)<\/h3>\n<p>The <strong>NodeSource<\/strong> is the third-party repository of <strong>Node.js <\/strong>containing multiple <strong>Node.js<\/strong> versions. Users can install<strong> Node.js<\/strong> on Ubuntu via<strong> NodeSource<\/strong>. However, the <strong>NodeSource <\/strong>repository does not come pre-added on Ubuntu. To add <strong>NodeSource (PPA) <\/strong>to the system the curl command-line tool is used. Check the following steps to install <strong>Node.js <\/strong>on Ubuntu 22.04 using the <strong>NodeSource <\/strong>PPA repository.<\/p>\n<p><strong>Step 1: Install curl on Ubuntu<\/strong><\/p>\n<p>Before installing <strong>Node.js<\/strong>, it is necessary to add the <strong>NodeSource<\/strong> repository on Ubuntu, for that we first need to install the curl command line utility using the following command:<\/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> curl<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"817\" height=\"288\" class=\"wp-image-26019\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-5.png 817w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-5-300x106.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-5-768x271.png 768w\" sizes=\"auto, (max-width: 817px) 100vw, 817px\" \/><\/p>\n<p><strong>Step 2: Add NodeSource Repository<\/strong><\/p>\n<p>Once the curl utility is installed, let&#8217;s determine the latest <strong>Node.js <\/strong>version by navigating to the <a href=\"https:\/\/deb.nodesource.com\/\">NodeSource web page<\/a>. By the time of writing this guide, <strong>NodeSource <\/strong>has the 20.x version. We copied the repository link and provided it to the curl command to add the <strong>NodeSource <\/strong>repository to the system, as shown below:<\/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_20.x <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"re5\">-E<\/span> <span class=\"kw2\">bash<\/span> -<\/div><\/div>\n<p>Remember to replace the 20 with your desired version:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"270\" class=\"wp-image-26031\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-6.png 872w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-6-300x93.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-6-768x238.png 768w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\" \/><\/p>\n<p><strong>Step 3: Install Node.js on Ubuntu<\/strong><\/p>\n<p>Once the <strong>NodeSource <\/strong>repository is added to the Ubuntu system, run the below command to install <strong>Node.js <\/strong>on Ubuntu through the apt command, as shown below:<\/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=\"813\" height=\"379\" class=\"wp-image-26044\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-7.png 813w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-7-300x140.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-7-768x358.png 768w\" sizes=\"auto, (max-width: 813px) 100vw, 813px\" \/><\/p>\n<p><strong>Step 4: Verify Node.js Installation<\/strong><\/p>\n<p>Once the <strong>Node.js<\/strong> is installed via <strong>NodeSource<\/strong>, execute the mentioned command to verify the version:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nodejs <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"812\" height=\"114\" class=\"wp-image-26057\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-8.png 812w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-8-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-8-768x108.png 768w\" sizes=\"auto, (max-width: 812px) 100vw, 812px\" \/><\/p>\n<p>You can also check the <strong>NPM<\/strong> version installed along with <strong>Node.js <\/strong>by using the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">npm <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"113\" class=\"wp-image-26065\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-9.png 811w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-9-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-9-768x107.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/p>\n<h3><a id=\"post-25979-_sxe2j94sso2x\"><\/a>Method 3: Install Node.js on Ubuntu 22.04 Through Node Version Manager (NVM)<\/h3>\n<p>Another alternate method to install <strong>Node.js <\/strong>on Ubuntu is using the <strong>NVM \u201cNode Version Manager\u201d<\/strong>. <strong>NVM <\/strong>utility allows the management of the different versions of <strong>Node.js<\/strong> on Ubuntu. It comes up with various <strong>Node.js<\/strong> versions and gives the freedom to the user to install and use any version of <strong>Node.js <\/strong>on Ubuntu.<\/p>\n<p>Check the following steps to install <strong>Node.js <\/strong>on Ubuntu through <strong>NVM.<\/strong><\/p>\n<p><strong>Step 1: Install NVM on Ubuntu<\/strong><\/p>\n<p>Before installing <strong>NVM<\/strong>, first, visit the <a href=\"https:\/\/github.com\/nvm-sh\/nvm\">GitHub link<\/a> to verify the latest version. Once the latest version is verified copy its link and provide the curl command to install <strong>NVM <\/strong>on Ubuntu, as shown below:<\/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=\"1217\" height=\"358\" class=\"wp-image-26076\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-10.png 1217w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-10-300x88.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-10-1024x301.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-10-768x226.png 768w\" sizes=\"auto, (max-width: 1217px) 100vw, 1217px\" \/><\/p>\n<p><strong>Step 2: Save Changes<\/strong><\/p>\n<p>Once the <strong>NVM<\/strong> is installed on Ubuntu, run the given command to save the changes to the system:<\/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=\"886\" height=\"91\" class=\"wp-image-26079\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-11.png 886w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-11-300x31.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-11-768x79.png 768w\" sizes=\"auto, (max-width: 886px) 100vw, 886px\" \/><\/p>\n<p><strong>Step 3: Install Node.js on Ubuntu<\/strong><\/p>\n<p>Before installing <strong>Node.js<\/strong>, first list down the already installed <strong>Node.js<\/strong> versions through the mentioned command:<\/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=\"737\" height=\"201\" class=\"wp-image-26080\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-12.png 737w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-12-300x82.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<p>According to the above output, there are no <strong>Node.js<\/strong> versions installed on the system.<\/p>\n<p>Let\u2019s get the list of<strong> Node.js <\/strong>versions we can install on Ubuntu by running the mentioned command:<\/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=\"733\" height=\"345\" class=\"wp-image-26083\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-13.png 733w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-13-300x141.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"397\" class=\"wp-image-26084\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-14.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-14-300x161.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<p>There are numerous <strong>Node.js<\/strong> versions we can install on Ubuntu.<\/p>\n<p>Let&#8217;s install the latest <strong>Node.js <\/strong>version on Ubuntu by specifying the version number to the install command alongside the <strong>nvm <\/strong>command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm <span class=\"kw2\">install<\/span> v20.11.1<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"818\" height=\"245\" class=\"wp-image-26087\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-15.png 818w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-15-300x90.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-15-768x230.png 768w\" sizes=\"auto, (max-width: 818px) 100vw, 818px\" \/><\/p>\n<p>After installing the latest <strong>Node.js<\/strong> version, let\u2019s get the <strong>Node.js<\/strong> versions again by running the below command:<\/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=\"814\" height=\"443\" class=\"wp-image-26089\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-16.png 814w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-16-300x163.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-16-768x418.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/p>\n<p>From the above output, we can see that the latest <strong>Node.js <\/strong>version is installed and listed.<\/p>\n<p><strong>Step 4: Verify Node.js Installation<\/strong><\/p>\n<p>Once you have installed the <strong>Node.js<\/strong> package using <strong>NVM<\/strong>, place the <strong>&#8211;version<\/strong> flag alongside the node command to verify whether you have installed the latest version or not:<\/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=\"816\" height=\"114\" class=\"wp-image-26092\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-17.png 816w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-17-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-17-768x107.png 768w\" sizes=\"auto, (max-width: 816px) 100vw, 816px\" \/><\/p>\n<h3><a id=\"post-25979-_9uvpejchcpc7\"><\/a>Method 4: Install Node.js on Ubuntu 22.04 Through Snap<\/h3>\n<p>Ubuntu users can also install the <strong>Node.js<\/strong> package via the Snap package manager. Snap is an all-in-one package that consists of all the dependencies of a specified package. One major flex of Snap is that it installs the applications quickly with a single command. For instance, let&#8217;s install <strong>Node.js<\/strong> on Ubuntu 22.04 using the Snap package manager.<\/p>\n<p>Execute the mentioned command to install the stable release of the <strong>Node.js <\/strong>package using Snap:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> snap <span class=\"kw2\">install<\/span> node <span class=\"re5\">--classic<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"815\" height=\"114\" class=\"wp-image-26098\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-18.png 815w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-18-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-18-768x107.png 768w\" sizes=\"auto, (max-width: 815px) 100vw, 815px\" \/><\/p>\n<p>Check whether the <strong>Node.js<\/strong> was installed through Snap or not by running the below 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=\"806\" height=\"113\" class=\"wp-image-26102\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-19.png 806w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-19-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-19-768x108.png 768w\" sizes=\"auto, (max-width: 806px) 100vw, 806px\" \/><\/p>\n<h2><a id=\"post-25979-_8qqwq8z34ra6\"><\/a>How to Uninstall Node.js from Ubuntu 22.04<\/h2>\n<p>These are the methods through which you can remove <strong>Node.js<\/strong> from Ubuntu:<\/p>\n<ul>\n<li><a href=\"#post-25979-_w20pqdfr54y1\">apt Package Manager<\/a><\/li>\n<li><a href=\"#post-25979-_qysiirvig2e\">NVM<\/a><\/li>\n<li><a href=\"#post-25979-_310q5nb2mi7c\">Snap<\/a><\/li>\n<\/ul>\n<h3><a id=\"post-25979-_w20pqdfr54y1\"><\/a>Method 1: Remove Node.js from Ubuntu Using apt Package Manager<\/h3>\n<p>The method to uninstall <strong>Node.js<\/strong> through apt is the same as installing the <strong>Node.js<\/strong> on Ubuntu, except for the remove command. To remove the <strong>Node.js<\/strong> from Ubuntu, execute the mentioned command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt remove nodejs <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"267\" class=\"wp-image-26108\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-20.png 811w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-20-300x99.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-20-768x253.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/p>\n<p>To remove the dependencies related to the <strong>Node.js<\/strong> package, run the mentioned command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt autoremove nodejs <span class=\"re5\">-y<\/span><\/div><\/div>\n<h3><a id=\"post-25979-_qysiirvig2e\"><\/a>Method 2: Remove Node.js from Ubuntu Using NVM<\/h3>\n<p>Check the following steps to remove <strong>Node.js <\/strong>from Ubuntu using <strong>NVM<\/strong>.<\/p>\n<p><strong>Step 1: Check the Current NVM Version<\/strong><\/p>\n<p>To remove <strong>Node.js <\/strong>using NVM, you need to provide the version number to the <strong>nvm uninstall <\/strong>command. So to know the version currently installed on Ubuntu execute the below command:<\/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=\"815\" height=\"116\" class=\"wp-image-26113\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-21.png 815w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-21-300x43.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-21-768x109.png 768w\" sizes=\"auto, (max-width: 815px) 100vw, 815px\" \/><\/p>\n<p><strong>Step 2: Deactivate NVM<\/strong><\/p>\n<p>Once you retrieved the version number of the <strong>Node.js<\/strong>, now deactivate <strong>NVM<\/strong> by running the given command:<\/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=\"813\" height=\"113\" class=\"wp-image-26116\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-22.png 813w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-22-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-22-768x107.png 768w\" sizes=\"auto, (max-width: 813px) 100vw, 813px\" \/><\/p>\n<p><strong>Step 3: Uninstall NVM<\/strong><\/p>\n<p>After deactivating <strong>NVM<\/strong>, you can easily remove <strong>Node.js<\/strong> by providing the version number to the <strong>nvm<\/strong> <strong>uninstall<\/strong> command, as shown below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nvm uninstall v20.11.1<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"815\" height=\"112\" class=\"wp-image-26119\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-23.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-23.png 815w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-23-300x41.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-23-768x106.png 768w\" sizes=\"auto, (max-width: 815px) 100vw, 815px\" \/><\/p>\n<h3><a id=\"post-25979-_310q5nb2mi7c\"><\/a>Method 3: Remove Node.js from Ubuntu Using Snap<\/h3>\n<p>To remove <strong>Node.js<\/strong> from Ubuntu installed through the Snap package manager, use the below-given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> snap remove node<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"818\" height=\"113\" class=\"wp-image-26120\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-24.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-24.png 818w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-24-300x41.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25979-24-768x106.png 768w\" sizes=\"auto, (max-width: 818px) 100vw, 818px\" \/><\/p>\n<h2><a id=\"post-25979-_cykvl7ed4jwg\"><\/a>Conclusion<\/h2>\n<p><strong>Node.js<\/strong> is technically the most sound and trusted JavaScript&#8217;s runtime environment. The <strong>Node.js<\/strong> can be installed on Ubuntu using <strong>apt package manager<\/strong>, <strong>NodeSource (PPA) repository<\/strong>, <strong>NVM<\/strong>, and <strong>Snap package manager<\/strong>. The <strong>apt method<\/strong> is simple but doesn\u2019t guarantee installing the latest <strong>Node.js<\/strong> version. However, the <strong>NodeSource repository<\/strong> and <strong>NVM<\/strong> let you install the most recent version of <strong>Node.js<\/strong> on Ubuntu. While the <strong>Snap method <\/strong>lets you install the <strong>Node.js <\/strong>version on Ubuntu in a quick manner.<\/p>","protected":false},"excerpt":{"rendered":"<p>You can install Node.js on Ubuntu 22.04 using apt package manager, NodeSource (PPA) repository, NVM, and Snap package manager. <\/p>","protected":false},"author":116,"featured_media":26128,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-25979","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\/25979","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\/116"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=25979"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/25979\/revisions"}],"predecessor-version":[{"id":26131,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/25979\/revisions\/26131"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/26128"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=25979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=25979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=25979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}