hero-image

Install Nodejs on Ubuntu

1 Minute

04/16/2021

Do you need to install a specific version of node on linux? That's usually one of my first steps. Along with installing chrome and visual studio code.

Installing Node Version Manager

The easiest way I've found to get node installed is with Node Version Manager (nvm). This utility allows you to quickly install, and switch between, versions of node. To get started, use curl to pipe the script into bash.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

Installing Node LTS

If you know which version of node you need you can install it directly.

nvm install 14.15.2

Or, if you just want the LTS distribution of a version.

nvm install 14 --lts

You'll see the version you requested download and install.

install-node-14.gif

Changing Versions

If you ever end up working on multiple projects that each require a different version of node, you can switch versions quickly by using the use command. It allows you to switch to any installed version.

nvm-select-version.gif

Closing

I hope this tutorial helped you get node installed quickly. If it did you should go give nvm some stars, it's a great time saver!


References

GitHub - nvm-sh/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - GitHub - nvm-sh/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active nod...