Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install latest node version on Ubuntu?

Tags:

node.js

ubuntu

I want to install the latest node (v6.2.0 at the time of writing) on Ubuntu. But as I do

sudo apt-get nodejs

This installed v0.10.37.

Can you please help me in installing the latest version of node js and also npm latest version?

like image 790
Aman Gupta Avatar asked May 26 '16 17:05

Aman Gupta


2 Answers

This is very simple, Grab the Linux node distribution from here: https://nodejs.org/dist/v6.2.0/

Open Terminal and type below command:

sudo tar -C /usr/local --strip-components 1 -xzf ~/Downloads/node-v6.2.0-linux-x64.tar.gz

ls -l /usr/local/bin/node

That`s it.

Now check your node version by typing:

node -v
npm -v

One can install any version of node in Ubuntu using above steps.

like image 156
Ashutosh Ranjan Avatar answered Oct 26 '22 10:10

Ashutosh Ranjan


There is official instruction:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Follow https://deb.nodesource.com/setup_6.x to read shell script before execute above commands.
You always must to know what you run, especially by sudo.

like image 36
vp_arth Avatar answered Oct 26 '22 09:10

vp_arth