I'm updating the info on the available packages.

sudo apt-get update

Then, I'm installing NodeJs and NPM.

sudo apt-get install nodejs
sudo apt-get install npm

When finished, I get the message that the latest version is installed. I also verify it.

nodejs --version

It says that the version is 8.10.0. However, when I check on NodeJs' page, it says that the latest current version is 10.10.0 (and even the LTS version is higher, 8.11.4).

Clearly, I'm not getting the latest version and being a noob on Linux, I'm sure I've done something wrong, despite following a guide.

My version is, according to the "About", 18.04.1 LTS.

  1. What am I missing in my ignorance?
  2. How can I install the recent version of NodeJs?
  • That guide uses 8.x for the nodesource script, use 10.x for the script/repo instead, and it should "Just Work". – Thomas Ward Sep 10 '18 at 16:42
  • Use the NodeJS guide - nodejs.org/en/download/package-manager/… - and not the Digital Ocean one which is basically identical. You'll notice it has instructions for the 10.x repo setup. – Thomas Ward Sep 10 '18 at 16:43
  • @ThomasWard If I understand the commands correctly, the curl call download the binaries and then the sudo line executes the installation of it. I'm coming from Windows and in my world, one always downloads stuff that are to be installed. Is the apt-get install method the proper one for Linux in general? It seems quite cumbersome to curl in every software that has a newer version than what it had when my distribution of OS was released. And needless, as I can't rely on the repo listing update. Am I missing something? – Konrad Viltersten Sep 10 '18 at 17:58
  • That script only sets up the repositories. In Ubuntu, you typically install softwrae with the Package Manager - apt-get or aptitude, and configure the system to know what remote package repositories to "reach out to" for the packages. That installation script that you download sets up the proper repositories and then will allow you to follow the apt-get commands. This is, unfortunately, the most easiest way to get the updated NodeJS directly from them... the concept of standalone "Download and run the installer" exists but is not widespread in the Linux worlds. – Thomas Ward Sep 10 '18 at 18:01
  • @ThomasWard As a long time Windows user, I find this whole Linux thingy exciting. I understand that the confusion is due to my ignorance and I find joy in discovering how-to's. That being said, please post your comments as a reply so it can be accepted as an answer. Is apt and apt-get shorthand for aptitude? I thought it was acronym for application package tooling but I might very well be mistaken. – Konrad Viltersten Sep 10 '18 at 18:08

Use the NodeJS guide for installing the 10.x repo. These instructions are roughly copied here below:

Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository (formerly Chris Lea's Launchpad PPA). Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 6.x on older distros.

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Alternatively, for Node.js 10:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

Optional: install build tools

To compile and install native addons from npm you may also need to install build tools:

sudo apt-get install -y build-essential

Available architectures:

  • i386 (32-bit)
  • amd64 (64-bit)
  • armhf (ARM 32-bit hard-float, ARMv7 and up: arm-linux-gnueabihf)

Supported Ubuntu versions:

  • Ubuntu 14.04 LTS (Trusty Tahr)
  • Ubuntu 16.04 LTS (Xenial Xerus)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.