updating nodejs on ubuntu 16.04

ankur picture ankur · Dec 17, 2016 · Viewed 261.3k times · Source

I was recently going through the version of node in my ubuntu 16.04 when node -v command was used it shows me version 6.9.1 but when nodejs -v it shows 6.9.2 previously before using this commands npm update command was used.

Now what's these difference in node -v and nodejs -v? and how to update to the latest LTS version of node/nodejs?

Answer

Camille Gerin-Roze picture Camille Gerin-Roze · Dec 17, 2016

To update, you can install n

sudo npm install -g n

Then just :

sudo n latest

or a specific version

sudo n 8.9.0