How to upgrade the Node.js version using NPM

How to upgrade the Node.js version using NPM

The relationship between NPM and Node.js is always blurry to me. Whenever I have to upgrade my version of node, I am always a little confused so Iā€™m adding this here for reference:

Before:

$ node --version
v5.8.0

We run the following three commands:

npm cache clean -f
npm install -g n
n stable

After:

$ node --version
v5.10.1

Reference: http://theholmesoffice.com/node-js-fundamentals-how-to-upgrade-the-node-js-version/