• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Node.js on Ubuntu 20.04 LTS

Written by Admin, Updated On May 8, 2020
nodejs, npm, nvm, ubuntu, yarn
How to Install Node.js on Ubuntu 20.04 LTS

Node.js is an opensource cross-platform JavaScript runtime environment that executes JavaScript code outside of a web browser. It’s used for building server side applications and command line tools using JavaScript. In this guide given two ways to install Node.js and the NVM on Ubuntu 20.04 LTS Focal Fossa.

npm is the default package manager for Node.js that helps developers to share and reuse their code.

Install Node.js and npm from the Ubuntu repositories#

You can install Node.js and npm from the standard Ubuntu repositories. We will use apt command to install the stable default Node.js version from the Ubuntu repository:

sudo apt update
sudo apt install nodejs

Verify the node.js version, type:

node --version
v10.15.2

NPM doesn’t ships with Node so you’ll need to separately install it. Run the following command:

sudo apt-get install npm

After finishing the installation, check npm version:

npm -v
v5.8.0

Installing Node.js Using NVM#

NVM (Node Version Manager) is a bash script that provides facility to manage multiple Node.js versions. You can also use NVM for installing Node.js on your Ubuntu system. Perform the following steps to install any Node.js version on your system.

Open a terminal and install NVM manager using either curl or wget:

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

The installation script clones the nvm repository from Github to the ~/.nvm directory and adds the nvm path to your Bash or ZSH profile.

Once installation complete, you need to update the nvm environemt in current shell using below command:

source ~/.profile

Now, NVM is successfully installed on your system. Now you can choose specific version of node.js and install with NVM.

To list all available Node.js versions, type:

nvm ls-remote
...
   v12.13.0 (LTS: Erbium)
   v12.13.1 (Latest LTS: Erbium)
   v13.0.0
   v13.0.1
   v13.1.0
-> v13.2.0

Choose specific version and execute the following command to install, here we will install v13.2.0:

nvm install 13.2.0

Verify installation by checking it’s version:

node -v

It should show as below:

v13.2.0

Uninstalling Node.js#

If you want to uninstall Node.js and npm packages, use the following command:

sudo apt remove nodejs npm

Conclusion#

In this tutorial we have shown you two methods to install Node.js on Ubuntu 20.04 Focal Fossa system.

Now that you’ve installed Node.js on your Ubuntu 20.04 system, it’s time to deploy your application.

If you have any questions or feedback, feel free to comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install OpenCV on CentOS 8 Server
Next Article   How to Install Apache, MySQL, PHP (LAMP) on Ubuntu 20.04

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Python 3.11 on Debian 11
    How to Install Python on Debian 11 January 25, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook