How to decide the right Node.js version and install/uninstall it on Linux(Ubuntu, Linux Mint)?

Node.js Explained for Beginners

In the previous article, we have learned what is Node.js and the logic behind all those fancy Node.js concepts for beginners.

In this article, we will learn how to decide the most suitable Node.js version for you and install/uninstall it on your Debian based Linux machine. Through this article, I tested installation/uninstallation on Ubuntu 18.04 and Linux Mint 19.1.

First, let’s start with Node.js in terms of deciding which version we should use.

Node.js Versions

If you visit the website, you will see two different Node.js versions as “Recommended For Most Users” version option and “Latest Features” version option.

When this article is written, “Recommended For Most Users” version is 12.13.0 LTS and “Latest Features” version is 13.0.1 Latest Features (Current). You might confuse a little bit about those LTS and Latest Features (Current) words. 

LTS Version

As a general term in software development, LTS stands for long-term support which indicates the LTS version of the developed/developing software is still maintaining for a longer period of time than other versions. Maintaining software means that we can have security updates, bug fixes, minor feature upgrades in a given period of time of LTS.

So what about other versions? Why are they developing other versions too? 

Latest Features (Current) Version

Latest Features (Current) version is being developed because without affecting the stable production environments and spooking the legacy users, it is not so possible to build high-end features. Thanks to that we can have major performance improvements, extra additional functionalities, architectural changes.

At the end of the Latest Features version development cycle, its codebase will be moved to the next LTS version with all changes and improvements. So it will become a more stable and secure environment to use.

That is why in Node.js community, “Recommended For Most Users” is most suitable for the production environment and “Latest Features” is for experimenting latest Node.js features. But at the end of the day, we know that the latest features will be added to the next LTS version.

In order to review Node.js releases, you can check this URL:

From their graph, you can easily understand that even-numbered versions are LTS versions and odd-numbered ones are the latest feature versions. Also, you can see their end of development dates and maintenance durations for each different version.

Now we can decide which Node.js version we should choose and start the installation right away. I assume that we need to build a secure and stable application thus we can choose the current LTS version 12.13.0.

Node.js Installer and Source

From Node.js community website download page link, you can see that it can work any Windows, Mac OS, or Linux machine. You have two options to install on your machine as you can download its installer or you can build it from its source code. Also, you have an option to run on a docker container with its docker image but unfourtunalety this article is not covering docker containers.


Before the beginning of the installation of Node.js, I want to give you some information about npm. We already know from the previous article that Node.js is a JavaScript runtime environment and it comes with its default package manager npm. 

Npm is the world’s biggest package manager among all others like pip in Python, Composer in PHP, RubyGems in Ruby, etc. Also, npm is not Node.js oriented, it can be also used in any other JavaScript frameworks or libraries.

Curious ones that don’t know about package managers may ask: “Why do we need package managers?”

In the past, it was not easy to manage software dependencies (third-party libraries). 

You had to add every dependency codebase into your codebase which makes yours heavier to store and move along other machines. Also, the dependencies might have other dependencies and this can go in a recursive way. This problem may result in bigger problems in the future if we want to update, change or remove any dependency. 

Thanks to the package managers, instead of storing all codebase of all interdependent dependencies, we are just storing their names and version numbers in a simple file. All dependency codebase management responsibility is taken from us and these libraries are stored in the servers of package managers. For example, right now npm already passed 1 million package numbers and it is widely being used among lots of different major JavaScript frameworks and libraries.

After a quick break lets continue with the installation/uninstallation process. But before starting the installation, please first check whether you have installed Node.js or npm already. Because lots of frameworks are using Node.js as their infrastructure. So you might be installed Node.js without knowing it.

Node.js and npm Version Check

The most common way to check is Node.js and npm is installed or not is by checking their versions:

$node -v
$npm -v

Sample output will be if you have already installed Node.js:

But we don’t want this Node.js version. So let’s remove it:

Node.js Uninstallation

As a common approach, you can remove Node.js and its configuration files with purge:

$sudo apt purge nodejs

But sometimes you still can not get rid of from installed Node.js and npm. As a solution first detect their installation folders and remove them directly. For detection:

$which node
$which npm

Sample output:

Now you know where they are installed. Just remove them:

$sudo rm /usr/local/bin/node
$sudo rm /usr/local/bin/npm

Sample output:

If you check Node.js and npm is whether installed or not:

You can get this output if you have never installed Node.js too.

After we ensured that we don’t have Node.js or npm installed on our system, we can start the installation process.

Node.js Installation

The first easiest approach to install any package to your Debian based machine can be:

$sudo apt update
$sudo apt install nodejs
$sudo apt install npm

You need to install npm separately because Node.js package is not coming with npm for this specific case. Then check the installed Node.js and npm versions:

As you can see both Node.js and npm versions are outdated. Because when we use apt to install packages, by default we are using Universe repositories. These repositories may not be up to date all the time.

In order to install the latest desired Node.js and npm version, we need to use PPA (Personal Package Archive) of the Node.js community thanks to NodeSource ( Basically add the desired repository to your Linux package sources then start the same installation process.

$curl -sL | sudo -E bash -
$sudo apt-get install -y nodejs

If you want to install the 13.^ version (Latest Features) of Node.js, you can simply change it to:

$curl -sL | sudo -E bash -
$sudo apt-get install -y nodejs

We have just installed Node.js and npm all together. Please note that by using this PPA, we don’t need to install npm separately and deal with its version.

You can see from, each Node.js versions have their specific npm version to compatible with. That is why it is really helpful to install Node.js through PPA.

After the installation, you can check the installed version of Node.js and npm as

$node -v
$npm -v

Sample output:

As you can see now we have installed the desired Node.js on our Linux machine.

Let’s try our Node.js environment in two different ways. 

  1. Try Node.js interpreter by typing node on the terminal and write any JavaScript code right away.

Sample Output:

Every time you need to test some JavaScript feature you can easily open this interpreter and test it.

2. Create an example JavaScript file and run it via Node.js. You can create test.js file in your current directory and just add:

console.log(“Hello World!”);

Then in order to run it:

$node test.js

Sample Output:

You can check which Ecma Script version and features are supported in your Node.js version from As you can see 12.13.0 is already covering most of the ES2020 features.

I hope this article has helped you in terms of understanding Node.js versions and installation/uninstallation on your Debian based Linux machine. Also, if you feel uncomfortable about some topics of Node.js, I really encourage you to read Node.js Explained for Beginners article.

If you want to learn more about Web Development, don’t forget to subscribe to our newsletter and if you have any questions, please don’t hesitate to contact with me.

See you in new articles.

Leave a Reply

Your email address will not be published. Required fields are marked *