Can't install the latest version of NodeJs despite update prior to the attempt
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.
- What am I missing in my ignorance?
- How can I install the recent version of NodeJs?
Solution 1:
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)