How to Install Node.js on Ubuntu 18.04 Bionic Beaver

Install Node.js on Ubuntu 18.04 Bionic Beaver

In this article, we will have explained the necessary steps to install and configure Node.js on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Node.js is an open source cross-platform JavaScript run-time environment that allows server-side execution of JavaScript code which simply means that you can run JavaScript code on your machine as a standalone application, free of any web browser.

Node.js is mainly used to build back-end server-side applications, but it is also very popular as a full-stack and front-end solution. Npm is the default package manager for Node.js and the world’s largest software registry.

Install Node.js on Ubuntu 18.04 Bionic Beaver

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade

Step 2. Install Node.js with npm on Ubuntu.

  • Install Node.js and npm using Ubuntu repository.
sudo apt install node

Confirm the installation of Node.js by typing:

node --version

Install npm by running following command:

sudo apt install npm

Confirm the installation of npm by typing:

npm --version
  • Install Node.js and npm using nvm.
curl -o- | bash

Check nvm version and confirm installation typing;

nvm --version

Now install Node.js by using the following command;

nvm install node

Verify Node.js installation by typing;

node --version
  • Install Node.js from NodeSource Repository.
curl -sL | sudo bash -

Now install Node.js and npm package typing.

sudo apt install nodejs

Verify installtion of Node.js and npm running following command

node --version
npm --version

That’s all you need to do to install Node.js on Ubuntu 18.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.