Install Node Version Manager

Grab the script.

wget --quiet https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh --output-document /tmp/nvm_install.sh

Make the script executable, check it’s safe, and if happy then run it.

chmod u+x /tmp/nvm_install.sh
bash /tmp/nvm_install.sh

Restart your terminal session, or just source ~/.bashrc.

Now, check the available versions to install using nvm.

$ nvm ls-remote | grep "Latest LTS"
...
         v4.9.1   (Latest LTS: Argon)
        v6.17.1   (Latest LTS: Boron)
        v8.17.0   (Latest LTS: Carbon)
       v10.21.0   (Latest LTS: Dubnium)
       v12.18.2   (Latest LTS: Erbium)

Install the required version, in this case the latest LTS version.

nvm install v12.18.2

Check the version of node.

$ node -v
v12.15.0

nvm should switch to the most recently installed version. You can tell nvm to use another version you have installed though.

nvm use v12.15.0

Check any versions you have installed.

nvm ls

You can default any version downloaded.

nvm alias default v12.15.0

About

I'm a technology professional who's been passionate about computers since my Grandad introduced me to an Intel 386 back in the 90s when I was a kid. Those moments inspired a passion within for technology, and I've been playing around with anything with a circuit board ever since. Whenever I have a moment you can probably find me working on something computer-related, and this is where I like to write about those moments.