New Ubuntu and Node.js versions released recently. While neither is a long-term
service (LTS) release, they still represent the best that both parties have to
offer.
Even though Ubuntu 20.10 is here, it’s still shipping with an older version of
Node.js, v12.x to be exact. If you’re like me, you probably want to upgrade to
the latest version of Node.js and NPM.
Before we start, it’s always good to get your system up to date:
su -c 'apt update'
And to get curl
installed for downloading the installer:
su -c 'apt install -y curl'
Once we are up to date and have the necessary dependencies installed, we can
download and run the installation script:
su -c 'curl -sL https://deb.nodesource.com/setup_15.x | bash -'
Which will automatically detect which version of Ubuntu (or Debian) we’re
running and will proceed to install Node.js v15.
The installation script should automatically update your system, but in case it
didn’t, you’ll want to do so:
su -c 'apt update'
Then we can install Node.js v15 (or upgrade to it if we have a previous version
installed):
su -c 'apt install -y nodejs'
Once that’s all set, we can check to see which version of Node.js we’re running
to verify that things are looking good:
node --version # v15.0.0