How to upgrade NodeJS using NPM

Posted by Damodar Bashyal on September 08, 2017

 

Quick steps to upgrade:

Check current installed nodejs version.

[[email protected]]# node -v

Force clean cache.

[[email protected]]# npm cache clean -f

Install n module globally.

[[email protected]]# npm install -g n

Install latest and stable node using n.

[[email protected]]# n stable

install : node-v8.4.0
mkdir : /usr/local/n/versions/node/8.4.0
fetch : https://nodejs.org/dist/v8.4.0/node-v8.4.0-linux-x64.tar.gz
################################################################## 100.0%
installed : v8.4.0

Symlink above new node path to /usr/bin/node.

[[email protected]]# ln -sf /usr/local/n/versions/node/8.4.0/bin/node /usr/bin/node

Recheck installed node version to verify successfull installation.

[[email protected]]# node -v

 
not published on website


QR Code: How to upgrade NodeJS using NPM