update nodejs using npm

  • Current NodeJs Version – First check current nodejs version on your system using following command. In my case it is v0.10.37.
    pratheesh@pratheesh:~$ node -v v0.10.37 
  • Clean Cache Forcefully – Now clean all npm cache from your system forcefully.
    pratheesh@pratheesh:~$ sudo npm cache clean -f npm WARN using --force I sure hope you know what you are doing. 
  • Install n Module – After cleaning all cache from your system, now install n modules using npm command.
    :~$ sudo npm install -g n /usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n n@2.0.2 /usr/local/lib/node_modules/n 
  • Install Nodejs – Let’s install or update latest nodejs version on your system using n module.
    :~$ sudo n stable install : node-v6.0.0 mkdir : /usr/local/n/versions/node/6.0.0 fetch : https://nodejs.org/dist/v6.0.0/node-v6.0.0-linux-x64.tar.gz ############################################################ 100.0% installed : v6.0.0 
  • Setup Binary Link – Now link your node binary with latest nodejs installed binary file using following command.
    :~$ sudo ln -sf /usr/local/n/versions/node/6.0.0/bin/node /usr/bin/node 
  • Check Nodejs Version – Finally recheck your nodejs version. You will find that it showing latest version on your system.
    :~$ node -v v6.0.0
  • http://tecadmin.net/upgrade-nodejs-via-npm/#
    
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s