Two days before Canonical dropped the latest and greatest long term service release of Ubuntu, the Node.js Foundation dropped the latest and greatest (and eventually long term service release) of Node.js.
Due to the timing of things, Ubuntu 18.04 LTS was shipped with the current long term service release of Node.js, version 8.x (8.10.0 with the initial release).
This is great news if you’re content running the current long term service release of Node.js, but if you’re like me, you want the latest and greatest!
Side note, if you are good with Node.js 8 but want to run the latest version of the 8.x series, check out this post.
Back on the bleeding edge track, first, make sure you have
sudo apt install curl
Then download and execute the Node.js 10.x installer:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
This shouldn’t take too long and will add a source file for the official Node.js 10.x repo, grabs the signing key and will run
Note, if you have used the installer script for an older version of Node.js, running the aforementioned will write over the previous changes.
Once the installer is done doing it’s the thing, you will need to install (or upgrade) Node.js:
sudo apt install nodejs
That’ll do it, you’re all set with the latest and greatest version of Node.js 10.x on Ubuntu 18.04 LTS!