How To Install The Latest Version of Node.js on Ubuntu

Here is a quick and easy way to install the latest version of Node.js on an Ubuntu system. As with many things in the JavaScript world there is more than one way to do this, but for getting up-and-going quickly it’s hard to beat n.

First, make sure you have npm installed:

    $ sudo apt-get update
    $ sudo apt-get install npm

Then it is just a simple matter of globally installing n:

    $ sudo npm i n -g

Once n is installed you can install the latest version of Node.js with the following command:

    $ sudo n latest

Or, if you prefer the stable version use this:

    $ sudo n stable

Super simple. You can read more about n here