VOOZH about

URL: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04

⇱ How to Install Node.js on Ubuntu | DigitalOcean


Not using Ubuntu 20.04?
Choose a different version or distribution.
Ubuntu 20.04
👁 How to Install Node.js on Ubuntu

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

Tutorial Series: How to Install Node.js and Create a Local Development Environment

Node.js is a JavaScript platform for general-purpose programming that allows users to build network applications quickly. By leveraging JavaScript on both the front and backend, Node.js makes development more consistent and integrated.

To get your development environment configured so you can start building Node.js applications. select the tutorial for your platform.

About the author(s)

Senior Technical Writer at DigitalOcean

👁 Anish Singh Walia
Anish Singh Walia
Editor
Sr Technical Content Strategist and Team Lead
See author profile

I help Businesses scale with AI x SEO x (authentic) Content that revives traffic and keeps leads flowing | 3,000,000+ Average monthly readers on Medium | Sr Technical Writer(Team Lead) @ DigitalOcean | Ex-Cloud Consultant @ AMEX | Ex-Site Reliability Engineer(DevOps)@Nutanix

👁 Manikandan Kurup
Manikandan Kurup
Editor
Senior Technical Content Engineer I
See author profile

With over 6 years of experience in tech publishing, Mani has edited and published more than 75 books covering a wide range of data science topics. Known for his strong attention to detail and technical knowledge, Mani specializes in creating clear, concise, and easy-to-understand content tailored for developers.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I really appreciated the 3 options you gave us. I wonder though… I went with NVM and copied the code snippets to install it. Should I have used sudo with these commands. It appears that nvm was installed but only for my sudo user. I’m hoping (and guessing) this won’t be an issue. Thanks you!

If you want the nvm node version to be the default, ie stay set after reboot run this. $ nvm alias default <your version>

When following “Option 3 — Installing Node Using the Node Version Manager” you will be unable to “sudo npm”.

This can be fixed by running this command:

n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

From here.

If you go with option 1 or 2, you will probably face permission error issues.

In this case, make sure to configure npm to use a different directory.

Thanks Brian. This doc is very clear and complete and helped me a great deal.

If you’re using Option 2, you need to run sudo apt update after you’ve added the PPA to your configuration, otherwise you’ll get an error message about being Unable to locate package node.js…

In the version of this tutorial for ubuntu 18.04, there are instructions for installing the build essentials package, but not here. This is not required for this version?

If you’re using a non root user and having issues like this: “E: Failed to fetch http://mirrors.digitalocean.com/ubuntu focal InRelease” Try the command “sudo apt-get update”. If you have problem also with this command then you have to change the fetch link that gives you the error.

Try these commands:

  • a. cd (<- return to user root)
  • b. cd …/
  • c. ls (<- list all files) If you see an “etc” folder then type “cd etc/apt” otherwise repeat step “.a” & “.b”.

If you type “ls” you should see a “sources.list” file. We need to edit that.

Type: “vim sources.list”

Activate editor by pressing “i” then move to every link that has “mirrors.digitalocean.com” and change it to “archive.ubuntu.com”.

When you finish, press “esc” then “:w !sudo tee % > /dev/null”. File should be saved now.

Try installing nodejs now. Should work fine.

Hope it helps.

node -v node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27’ not found (required by node)

👁 Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

© 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.