{"id":4764,"date":"2019-05-30T09:30:03","date_gmt":"2019-05-30T04:00:03","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=4764"},"modified":"2026-10-24T12:07:39","modified_gmt":"2026-10-24T06:37:39","slug":"how-to-install-node-js-in-ubuntu-16-0-4","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-install-node-js-in-ubuntu-16-0-4\/","title":{"rendered":"How to Install node js in Ubuntu -16.0.4"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Post Date: <\/strong>May 30, 2019 <br><strong>Last Updated:<\/strong> October 24, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Install Node.js in Ubuntu<\/strong> using the NodeSource repository to get a current Node.js release on a supported Ubuntu system. Node.js is an open-source, cross-platform JavaScript runtime that runs JavaScript outside the browser. It&#8217;s commonly used for web servers, APIs, and command-line tools.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide updates an older tutorial that installed Node.js 12 on Ubuntu 16.04. It removes an obsolete prerequisite, avoids piping the NodeSource setup script directly into a root shell, and lets you choose the Node.js version you want.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Ubuntu 16.04 is end-of-life, and it can&#8217;t run current Node.js releases. Recent Node.js versions require a newer C library (glibc 2.28 or later) than Ubuntu 16.04 and 18.04 provide, and NodeSource&#8217;s current instructions list only Ubuntu 18.04 and later. To install Node.js in Ubuntu 16.04 today, you would be limited to old, unsupported Node.js versions. If you can, move to a supported Ubuntu LTS release first. The steps below work on those.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you install Node.js in Ubuntu, make sure you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A supported Ubuntu LTS release (see the note above)<\/li>\n\n\n\n<li>Root or sudo access<\/li>\n\n\n\n<li>An internet connection<\/li>\n\n\n\n<li>The Node.js version you want. Check the <a href=\"https:\/\/nodejs.org\/en\/about\/previous-releases\" target=\"_blank\" rel=\"noopener\">Node.js release schedule<\/a> and choose an LTS version for production<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ubuntu&#8217;s own repositories carry an old Node.js version, so you add a second package source. The NodeSource repository provides current Node.js builds packaged for <code>apt<\/code><\/li>\n\n\n\n<li>A small setup script adds the NodeSource repository and its signing key to your system<\/li>\n\n\n\n<li>After that, <code>apt<\/code> treats Node.js like any other package. It installs <code>nodejs<\/code>, which includes <code>npm<\/code>, and can update it later through normal system updates<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The image below shows what happens when you install Node.js in Ubuntu with this method. For NodeSource&#8217;s own documentation, see its <a href=\"https:\/\/github.com\/nodesource\/distributions\" target=\"_blank\" rel=\"noopener\">distributions repository<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Node.js-Ubuntu-Installation-Flowchart-1.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Node.js-Ubuntu-Installation-Flowchart-1-1024x683.png\" alt=\"\" class=\"wp-image-12478\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Node.js-Ubuntu-Installation-Flowchart-1-1024x683.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Node.js-Ubuntu-Installation-Flowchart-1-300x200.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Node.js-Ubuntu-Installation-Flowchart-1-768x512.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Node.js-Ubuntu-Installation-Flowchart-1-272x182.png 272w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Node.js-Ubuntu-Installation-Flowchart-1.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Install Node.js in Ubuntu<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Install the Prerequisites<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt-get update\nsudo apt-get install -y curl ca-certificates\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The original also installed <code>python-software-properties<\/code>. That package is obsolete, and it no longer exists on current Ubuntu releases, so the command would fail there. You don&#8217;t need it to add the NodeSource repository.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">2. Download the NodeSource Repository Setup Script<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>&lt;VERSION&gt;<\/code> with the major version you chose, for example <code>24<\/code> for Node.js 24:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -fsSL https:\/\/deb.nodesource.com\/setup_&lt;VERSION>.x -o nodesource_setup.sh\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The original used <code>setup_12.x<\/code>. Node.js 12 reached end-of-life in April 2022. A fixed version in a guide goes stale quickly, so always pick the version yourself.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">3. Review and Run the Script<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The original piped the download straight into <code>sudo bash<\/code>, which runs whatever the server returns as root without you seeing it. Look at the script first:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">less nodesource_setup.sh\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then run it:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo -E bash nodesource_setup.sh\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This adds the NodeSource repository and its signing key to your system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Install Node.js and npm<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now you can install Node.js in Ubuntu with a normal <code>apt<\/code> command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt-get install -y nodejs\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>nodejs<\/code> package from NodeSource also includes <code>npm<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Check Node.js Version and npm<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">node -v\nnpm -v\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These commands check Node.js version and confirm npm is present. Each prints a version number if the install worked. The <code>node -v<\/code> output should match the major version you chose in Step 2.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. Install Build Tools (Optional)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Some npm packages compile native code when you install them. If you hit build errors later, install the compiler tools:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt-get install -y build-essential\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Alternative: Install Node.js in Ubuntu with nvm<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you need several Node.js versions side by side, or you don&#8217;t want a system-wide install, use <a href=\"https:\/\/github.com\/nvm-sh\/nvm\" target=\"_blank\" rel=\"noopener\">nvm<\/a> (Node Version Manager). It installs Node.js into your own home directory, so it doesn&#8217;t need root access and you can switch versions with a command. Follow the install instructions on its GitHub page, since the install command changes with each nvm release.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you can&#8217;t install Node.js in Ubuntu cleanly, check these:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>GLIBC_2.28 not found<\/code> when you run <code>node<\/code>:<\/strong> your Ubuntu release is too old for that Node.js version. Upgrade Ubuntu, which is the real fix<\/li>\n\n\n\n<li><strong><code>E: Unable to locate package nodejs<\/code>:<\/strong> the setup script didn&#8217;t finish, or your Ubuntu release isn&#8217;t supported. Re-run Step 3, then run <code>sudo apt-get update<\/code><\/li>\n\n\n\n<li><strong><code>Package python-software-properties is not available<\/code>:<\/strong> you&#8217;re following an old command. Skip that package, as shown in Step 1<\/li>\n\n\n\n<li><strong>An old version shows up after installing:<\/strong> Ubuntu&#8217;s own <code>nodejs<\/code> package may be taking priority. Check which version <code>apt<\/code> will install with <code>apt-cache policy nodejs<\/code>, and remove the old package with <code>sudo apt-get remove nodejs<\/code> before installing the new one<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To install Node.js in Ubuntu, download the NodeSource setup script for the version you want, read it before running it, then install <code>nodejs<\/code> with <code>apt<\/code> and check Node.js version with <code>node -v<\/code>. Skip the obsolete <code>python-software-properties<\/code> package and the fixed Node.js 12 version from the original guide. Most importantly, run this on a supported Ubuntu release, because Ubuntu 16.04 can&#8217;t run current Node.js versions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Can I install Node.js in Ubuntu 16.04?<\/strong> Only older Node.js versions will run, and those are end-of-life. Current releases need a newer glibc than Ubuntu 16.04 provides. Upgrading Ubuntu is the better route.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Does the NodeSource nodejs package include npm?<\/strong> Yes. Installing <code>nodejs<\/code> from NodeSource also installs <code>npm<\/code>, so you don&#8217;t need a separate install step.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Which Node.js version should I choose?<\/strong> For production, pick a current LTS release, since those receive security fixes for longer. Check the release schedule before you decide.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Should I use NodeSource or nvm to install Node.js in Ubuntu?<\/strong> Use NodeSource for a system-wide install on a server, where updates come through <code>apt<\/code>. Use nvm when you need several versions or want to avoid root.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/node-js-file-system-module\/\" target=\"_blank\" rel=\"noreferrer noopener\">NODE JS FILE SYSTEM MODULE<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/using-cron-job-in-node-js\/\" target=\"_blank\" rel=\"noreferrer noopener\">Using Cron Job in Node.js<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Technology Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Building or deploying Node.js applications? Our team can help with Node.js development, server setup, deployment pipelines, and ongoing DevOps support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Connect with our technology experts.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: May 30, 2019 Last Updated: October 24, 2026 Introduction Install Node.js in Ubuntu using the NodeSource repository to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12475,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-4764","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1eQ","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Install-Node.js-on-Ubuntu-Tutorial.png","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=4764"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4764\/revisions"}],"predecessor-version":[{"id":12479,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4764\/revisions\/12479"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media\/12475"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}