Updating out of date node versions easily
Open your console and check your Node.js version.
$ node -v
v x.x.x```
Install n package using npm if you do not have it installed yet.
$ sudo npm install -g n```
Then, you can update your Node.js to the version you want.
(Use this command to install the stable node release.)
$ sudo n stable(Use this command to install/update the latest node release.)
$ sudo n latest(Use this command to install/update the latest LTS node release.)
$ sudo n lts```
That’s it! You can verify that the update is successful by checking your Node.js version again.
$ node -v
v x.x.x```