If you try installing the latest version of node using the apt-package manager, you’ll end up with v10.19.0. This is the latest version in the ubuntu app store, but it’s not the latest released version of NodeJS.

This is because when new versions of a software are released, it can take months for the Ubuntu team to test and release in the official Ubuntu store. As a result, to get the latest versions of any software, we may have to use private packages published by developers.

In this tutorial, what we want to do is get either **v12.18.1 **(LTS - with Long term support) or **v14.4 **of Node. To get the latest versions, we can use either nodesource or nvm (node version manager). I’ll show you how to use both.

All commands here will be run using the Ubuntu CLI/terminal.

Using NVM - my preferred method

I like nvm because it allows me use different node versions for different projects.

Sometimes, you may be collaborating on a project with someone using a different version of node and you need to switch node versions to what the project requires. For this, nvm is the best tool.

Install NVM

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

To check that nvm is installed, type nvm --version. If you get a version number back like 0.35.3, then you know nvm was successfully installed.

Restart your terminal for your changes to take effect.

#ubuntu #node.js #npm

How to Install Node.js on Ubuntu and Update npm to the Latest Version
2.55 GEEK