• 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 Php 8 on Ubuntu 20.04

    How to Install PHP 8 on Ubuntu 20.04

    December 28, 2020
  • How to Install GIMP on Ubuntu 20.04

    How to Install GIMP 2.10 on Ubuntu 20.04

    December 22, 2020
  • How to Install Python 3.9 on Ubuntu 20.04

    How to Install Python 3.9 on Ubuntu 20.04

    December 21, 2020

Leave a Reply Cancel reply

Popular Posts

  • How to Install Python 3.9 on CentOS 8
    How to Install Python 3.9 on CentOS 8 December 31, 2020
  • How to Install Php 8 on Debian 10
    How to Install PHP 8 on Debian 10 January 2, 2021
  • How to Install GIMP 2.10 on CentOS 8
    How to Install GIMP 2.10 on CentOS 8 December 30, 2020
  • How to Install AnyDesk on Debian 10
    How to Install AnyDesk on Debian 10 Buster January 23, 2021
  • How to Install LibreOffice 7.0 on Debian 10
    How to Install LibreOffice 7.0 on Debian 10 January 25, 2021
© 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