How To Install NodeJS 16 Ubuntu 20.04 / Debian 10

Node.js is a JavaScript run time which-build on top of the V8 engine develops by Google. Designed to build scalable network applications. HTTP is a first-class citizen in Node.js, designed with streaming and low latency in mind. This makes Node.js well suited for the foundation of a web library or framework.

Update System

As usual, update the system to the latest version. It’s really important to keep the system updated to avoid unnecessary risk due to bug on an older version

sudo apt update
sudo apt upgrade -y

if there’s a kernel update, please restart your system to use the latest available version.

Install Dependency

To successfully install nodejs, install the dependency

sudo apt install curl -y

curl used for downloading installation script.

Install Nodejs 16

Since the official Ubuntu/Debian repository coming with an older version of Nodejs, we’ll use a 3rd-party repository which is provided by Nodesource, it’s some kind of official version, because it’s on Nodejs documentation. By using this repository, the version installed will keep update, but not upgraded to a newer version when available. Which is expected for the right approach by package repository.

curl -sL | sudo -E bash -
sudo apt install -y nodejs
# for development server you might need to install development tools
sudo apt-get install gcc g++ make

Verify Nodejs

To verify nodejs, run

dpkg -l | grep nodejs
# output
ii  nodejs                     16.1.0-deb-1nodesource1           amd64        Node.js event-based server-side javascript engine

using nodejs itself

node -v
# output

check npm version

npm -v
# output

Leave a Comment