Can't install the latest version of NodeJs despite update prior to the attempt

22,539

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)
Share:
22,539
Konrad Viltersten
Author by

Konrad Viltersten

Updated on September 18, 2022

Comments

  • Konrad Viltersten
    Konrad Viltersten almost 2 years

    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?
    • Thomas Ward
      Thomas Ward almost 6 years
      That guide uses 8.x for the nodesource script, use 10.x for the script/repo instead, and it should "Just Work".
    • Thomas Ward
      Thomas Ward almost 6 years
      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.
    • Konrad Viltersten
      Konrad Viltersten almost 6 years
      @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?
    • Thomas Ward
      Thomas Ward almost 6 years
      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.
    • Konrad Viltersten
      Konrad Viltersten almost 6 years
      @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.
    • Thomas Ward
      Thomas Ward almost 6 years
      They're different packages that all do the same thing slightly differently. apt is the one you should use, but you can use apt-get as the instructions indicate.
  • fsevenm
    fsevenm over 4 years
    What did work for me was using manual installation. And I successfully updated from 8.x to 13.x. This is the way I did, github.com/nodesource/distributions/blob/master/….