Install n thus:
sudo npm cache clean -f sudo npm install -g n
I don’t know that clearing the cache is actually necessary, but a number of people have recommended doing so.
Update to the latest version of node using:
sudo n stable
n allows node versions to be changed easily. The n package listing has details.