{"id":187,"date":"2023-01-09T08:38:24","date_gmt":"2023-01-09T08:38:24","guid":{"rendered":"https:\/\/www.dedicatedcore.com\/blog\/?p=187"},"modified":"2024-08-17T08:39:16","modified_gmt":"2024-08-17T08:39:16","slug":"install-node-js-ubuntu-latest-version","status":"publish","type":"post","link":"https:\/\/www.dedicatedcore.com\/blog\/install-node-js-ubuntu-latest-version\/","title":{"rendered":"How to Install Node.js on Ubuntu (22.04, 23.04)"},"content":{"rendered":"<p>It&#8217;s simple to node.js install on Ubuntu, and it&#8217;s a strong tool for creating server-side apps. Node.js can be installed on Ubuntu using a variety of techniques. Each of these has benefits and drawbacks. For those looking to expand their <a href=\"https:\/\/www.dedicatedcore.com\/blog\/install-elascticsearch-ubuntu\/\" target=\"_blank\" rel=\"noopener\">server functionality<\/a>, don&#8217;t miss our in-depth tutorial on setting up Elasticsearch on Ubuntu 22.04.<\/p>\n<p>Using the Ubuntu package manager to install Node.js is the simplest. The most recommended approach. This method entails downloading the most recent versions of Node.js. Also npm from the Ubuntu repository. Installing them using the apt package manager. The majority of consumers are advised to choose this technique. Just because it is simple to use and offers a secure installation. To ensure you&#8217;re <a href=\"https:\/\/www.dedicatedcore.com\/blog\/check-current-node-js-version\/\" target=\"_blank\" rel=\"noopener\">running the latest features<\/a>, learn how to check and install the current Node.js version by following our detailed manual.<\/p>\n<p>You may install and switch between various Node.js versions using nvm (Node Version Manager). If you need to handle many Node.js versions on your PC. Installing nvm, a utility that enables simple management of several Node.js versions. It is necessary for this procedure. You can download and install certain Node.js versions as needed. Then switch between them using nvm.<\/p>\n<p><iframe loading=\"lazy\" title=\"How To Install Node.js &amp; NPM on Ubuntu - Linux, Almalinux\" width=\"719\" height=\"404\" src=\"https:\/\/www.youtube.com\/embed\/H9XK2_ycKUI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h2>Different Techniques of Installing Node.js on Ubuntu<\/h2>\n<h3>Option 1: Download and Install Node.js from the Official Ubuntu 22.04 23.04 Repository<\/h3>\n<p>Npm and Node.js are included in the standard Ubuntu repositories. As a result, installing them is simple using the APT package manager. Update the Ubuntu system first:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo apt update<\/pre>\n<p>Next, use apt to install Node.js and NPM as seen below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo apt install nodejs npm<\/pre>\n<p>With this, Node.js and other necessary components are installed.<\/p>\n<h3>Option 2: Install Node.js from Nodesource as an Alternative.<\/h3>\n<p>To assist businesses in running production-ready Node.JS applications with performance, reliability, and security in mind, Nodesource is a Node.JS partner. If you want to install more recent versions of Node.JS and NPM, use this technique.<\/p>\n<p>The installation script that NodeSource offers refreshes the repository and adds the Nodesource repository to the list of sources. Therefore, download the script and execute it as follows using the curl command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ curl -fsSL https:\/\/deb.nodesource.com\/setup_18.x | sudo -E bash -<\/pre>\n<p>Install Node.JS using these instructions after the script has successfully run.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo apt install nodejs<\/pre>\n<p>This sets up Node.js along with other required dependencies and libraries. Run: to verify Node.js is installed.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ node --version<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-189\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/verify-node-js-installed.png\" alt=\"install node js on ubuntu 23.04\" width=\"800\" height=\"192\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/verify-node-js-installed.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/verify-node-js-installed-300x72.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/verify-node-js-installed-150x36.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/verify-node-js-installed-768x184.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/verify-node-js-installed-100x24.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/verify-node-js-installed-700x168.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<h3>Option 3: Set up NVM to Install Node JS and NPM<\/h3>\n<p>The script known as NVM, or &#8220;Node Version Manager,&#8221; enables you to control multiple Node.js versions on your computer. Run the following script to download and install NVM before installing NodeJS and NPM with it:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ curl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.39.1\/install.sh | bash<\/pre>\n<p>On the terminal, you will see a number of outputs as depicted.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-191\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-nvm-installation-script.png\" alt=\"setup nvm script for installing node js and npm\" width=\"800\" height=\"483\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-nvm-installation-script.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-nvm-installation-script-300x181.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-nvm-installation-script-150x91.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-nvm-installation-script-768x464.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-nvm-installation-script-100x60.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-nvm-installation-script-700x423.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Then, execute the instructions listed below to load nvm:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ export NVM_DIR=\"$HOME\/.nvm\"\r\n$ [ -s \"$NVM_DIR\/nvm.sh\" ] &amp;&amp; \\. \"$NVM_DIR\/nvm.sh\"\r\n$ [ -s \"$NVM_DIR\/bash_completion\" ] &amp;&amp; \\. \"$NVM_DIR\/bash_completion\"<\/pre>\n<p>Check the installed version of nvm as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ nvm -v<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-192\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checking-nvm-version.png\" alt=\"check installed nvm version\" width=\"800\" height=\"173\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checking-nvm-version.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checking-nvm-version-300x65.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checking-nvm-version-150x32.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checking-nvm-version-768x166.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checking-nvm-version-100x22.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checking-nvm-version-700x151.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Run the following command to get a list of every Node.js version that supports NVM:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ nvm ls-remote<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-193\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-list-nodejs-versions-using-nvm-command.png\" alt=\"check available node js versions using nvm command\" width=\"800\" height=\"590\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-list-nodejs-versions-using-nvm-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-list-nodejs-versions-using-nvm-command-300x221.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-list-nodejs-versions-using-nvm-command-150x111.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-list-nodejs-versions-using-nvm-command-768x566.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-list-nodejs-versions-using-nvm-command-100x74.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-list-nodejs-versions-using-nvm-command-610x450.png 610w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Next, you can install the latest available version of node.js with the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ nvm install node<\/pre>\n<p>Enter the version number to install a certain Node.js version. Run the following command, for example, to install NodeJS 18.1.0:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ nvm install 18.1.0<\/pre>\n<h4><strong>Final Thought of Installing Latest Version of Node.js on Ubuntu<\/strong><\/h4>\n<p>There are various ways to install Node.js on Ubuntu 22.04, 23.04, 20.04 each having pros and cons of their own. The approach you select will be determined by the needs and conditions you have. The most straightforward and suggested approach for managing. Managing various versions of Node.js is the Ubuntu package manager. Although more experienced users might prefer to utilize NodeSource or NVM.<\/p>\n<p>In the end, the strategy you use will rely on your unique wants and demands. The Ubuntu package manager technique is the simplest and best choice. Especially if you&#8217;re just getting started with Node.js. The NVM or NodeSource methods may be more appropriate if you have more complex requirements.<\/p>\n<p>Hope you got a crystal clear view of installing node.js. Such as requiring a certain version of Node.js or managing several versions of Node.js. A pre-built package can be the best choice if you&#8217;re utilizing a certain platform. A framework that needs a customized version of Node.js.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s simple to node.js install on Ubuntu, and it&#8217;s a strong tool for creating server-side apps. Node.js can be installed on Ubuntu using a variety&#8230;<\/p>\n","protected":false},"author":1,"featured_media":430,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/187"}],"collection":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/comments?post=187"}],"version-history":[{"count":13,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/187\/revisions"}],"predecessor-version":[{"id":190,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/187\/revisions\/190"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/media\/430"}],"wp:attachment":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/media?parent=187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/categories?post=187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/tags?post=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}