There are many ways to install Node.js. Some require more setup but will pay off later, such as installing Node Version Manager (nvm) on your development machine. Others are extremely straightforward and I'll recommend them to my NodeSchool students, like installing Node.js via the PKG file for macOS users.
This approach is similar to the latter in that a single version of an official Node.js package is downloaded and installed. I use this approach for things like one-off servers or Docker containers. This approach simply downloads a pre-compiled binary archive of Node.js from the official site and extracts it to
/usr/local, a directory already in
$PATH on Debian and Ubuntu (and probably other distributions as well).
$ wget https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-x64.tar.xz $ sudo tar -C /usr/local --strip-components 1 -xf node-*.tar.xz
Of course, you'll want to swap out the version of Node.js that you'd like to install. In the above example we're downloading
v12.14.0. Once the operation is complete you may run
node -v and you should see a version number in response.