While technically at end of life, if you’re stuck on the older Ubuntu 17.10, you can still enjoy the latest version of Node.js. Follow these quick and easy steps to get Node Version Manager and Node.js v14.x installed on your Ubuntu 17.10 system.<h2 id="getting-started">Getting started</h2>
Before we can install Node Version Manager (which will then be used to install
Node.js) we need to ensure that we have
curl installed so that we can easily
download the install script we need to run.
If you’re running inside of a Docker container, you should start by updating
your system, else you’ll run into errors about how the
curl package cannot be
su -c 'apt update'
Once things are up to date, install
su -c 'apt install -y curl'
Installing Node Version Manager
To get things running quickly and easily, we will download the installation script for Node Version Manager from the package’s repository and run it:
su -c 'curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash -'
Once Node Version Manager is installed, the script will log some lines that will
need to be added to your shell profile (
.zshrc, et cetera):
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
You will absolutely have to run those commands if you want to use
nvm from the
command line. If you copy and paste them back in the terminal, and close the
terminal out, you won’t have
nvm available until you run them again.
Installing Node.js v14.x
With Node Version Manager installed and the aforementioned shell profile
commands executed (making
nvm available) we can go ahead and install Node.js
nvm install 14
Without a minor version, Node Version Manage will install the latest versions of the v14.x series. If you’d like, you can specify the full version number to explicitly install that specific version.
To check that Node.js is the proper version, simply ask Node.js to spit out it’s version number:
node --version # v14.0.0
Setting Node.js v14.x as your default
If this is your first time using Node Version Manager, then Node.js v14.x will automatically be flagged as your default version.
If this isn’t your first rodeo, you probably have some other version of Node.js previously installed that is potentially your default.
To switch Node.js v14.x to be your default Node.js version, just alias it with
nvm alias default 14