How to Upgrade Node.js via NPM


http://tecadmin.net/upgrade-nodejs-via-npm/


NPM is a package manager for nodejs and many other languages. Currently I was running nodejs version v0.10.37 on my system. I was in required to install Latest nodejs package on my system. After searching I found the best and easier way to update your nodejs version using NPM quickly. It works perfectly for me and hope so for you.

Steps to Upgrade NodeJs:-

Use the following steps to install or upgrade nodejs to latest available version.

  • Current NodeJs Version – First check current nodejs version on your system using following command. In my case it is v0.10.37.
    rahul@tecadmin:~$ node -v 
    
    v0.10.37
    
  • Clean Cache Forcefully – Now clean all npm cache from your system forcefully.
    rahul@tecadmin:~$ 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.
    rahul@tecadmin:~$ 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.
    rahul@tecadmin:~$ 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.
    rahul@tecadmin:~$ 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.
    rahul@tecadmin:~$ node -v 
    
    v6.0.0
    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值