How to Install the Latest and Greatest Node.JS on Linux Mint

It is pretty easy to install the latest and greatest node.js. One way to do it is use apt install directly. But the version it is installed is v10.x. It is pretty old. To install the latest, you can go the following route.

First I need to download a install script:

curl -sL https://deb.nodesource.com/setup_17.x -o nodesource_setup.sh

At the writing of this tutorial, I was able to install version v17 of nodejs. And above command will download the script for v17. After the script is downloaded, run the next command:

sudo bash nodesource_setup.sh

This command will setup the repository for the latest version of node.js. Once the command completes, it will output a highlighted command for the next step: " sudo apt-get install -y nodejs". Go ahead and run that:

sudo apt-get install -y nodejs

Wait for the command to complete. And run the following command to verify:

node --version

The terminal should display this:

v17.7.0

Why do I have to do this: Having the latest version of node allows me to run the latest of Angular or React, and if I want to work on electron.js I can easily do that as well. With old version of node.js, most likely I will see error about dependencies needs the latest node version, and project cannot be build. So I need to update node periodically to the latest version. One can get far as long as one has the latest tools.

Addendum

In case you get the following error when running the bash command:

## Your distribution, identified as "vanessa", is not currently supported, please contact 
NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect 
or would like your distribution to be considered for support

All you have to do is open the script, then add the following line in the same section with similar lines:

...
check_alt "Linux Mint"    "ulyssa"   "Ubuntu" "focal"
check_alt "Linux Mint"    "uma"      "Ubuntu" "focal"
check_alt "Linux Mint"    "una"      "Ubuntu" "focal"
check_alt "Linux Mint"    "vanessa"  "Ubuntu" "jammy"
check_alt "LMDE"          "betsy"    "Debian" "jessie"
check_alt "LMDE"          "cindy"    "Debian" "stretch"
check_alt "LMDE"          "debbie"   "Debian" "buster"
...

This is the way of adding new release Linux Mint that latest Node.JS won't recognize. Good luck.

Another Addendum

In case that I cannot install the newer version of nodejs, I have to complete uninstall the old version of nodejs, then the newer version can be installed:

sudo apt autopurge nodejs

Again. Good luck to you.

Your Comment


Required
Required
Required

All Related Comments

Loading, please wait...
{{cmntForm.errorMsg}}
{{cmnt.guestName}} commented on {{cmnt.createDate}}.

There is no comments to this post/article.