Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have installed nodeJS on Ubuntu with following code

sudo apt-get install nodejs

Since I am a new user for ubuntu I also ran this code too

sudo apt-get install npm

Now when I type

 nodejs --version

It shows


I checked and saw latest nodeJS version is 0.10.26

How can I update my version of nodeJS to 0.10.26?

I tried with

 sudo apt-get install <packagename>
 sudo apt-get install --only-upgrade <packagename>

but no luck.

share|improve this question

6 Answers 6

up vote 116 down vote accepted

Use npm in order to upgrade node

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

Found in David Walsh blog http://davidwalsh.name/upgrade-nodejs

share|improve this answer
this should be the correct answer. n is a node helper package that installs or update a given node.js version. –  Martin Oct 2 '14 at 12:38
This should be the correct answer, also works for Mac OSX. –  tszming Dec 2 '14 at 15:55
I would advise strongly against doing this on a production instance. It can seriously mess stuff up with your global npm packages and your ability to install new ones. –  Loourr Feb 19 at 22:30
I get an error: /usr/bin/n: line 299: curl: command not found Error: invalid version 0.12.6 –  Fourat Jul 8 at 17:27
I found I needed one more step to complete the install: sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/node –  morloch Jul 9 at 22:57

You can install the latest version from PPA:

sudo add-apt-repository ppa:chris-lea/node.js  
sudo apt-get update  
sudo apt-get install nodejs
share|improve this answer
I think this would be a better answer if you (also) provided a non-ppa way of doing this, ppas are notoriously known for becoming outdated and unmaintained, essentially making the answer useless. –  pzkpfw Feb 27 '14 at 16:21
@bigbadonk420 yeah, if you just googled it, probably better to skip the first line and do just update and install-worked for me with node 0.10.34 –  Capaj Dec 22 '14 at 11:46
@Capaj nope. that didn't help... –  deostroll Dec 24 '14 at 0:47

Late answer, but this one is actually from the installation instructions:

Run this before you run apt-get:

curl -sL https://deb.nodesource.com/setup | sudo bash -

The above information is no longer up-to-date for v0.12.2. Instead, use the following taken from their blog post:

# Note the new setup script name for Node.js v0.12
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -

# Then install with:
sudo apt-get install -y nodejs
share|improve this answer
upvote for the update, thanks! –  Roy Ling May 14 at 6:22

I use nvm to handle my node versions. Very simple to set up and easy to use.

curl https://raw.github.com/creationix/nvm/master/install.sh | sh
source ~/.profile
nvm install 0.10.26
nvm use v0.10.26
which node
node -v
# install node globally (ie, into /usr/local)
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

Here's a good tutorial with more details:


share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Warren Hill Mar 31 '14 at 14:30
Apologies for my noobness. Updated answer –  amnah Mar 31 '14 at 16:27
the given curl path is not working. I used "curl raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash" as given in the github.com/creationix/nvm –  Senthil Aug 18 '14 at 3:35

I tried the same list commands on my ubuntu 14.04 but it was still throwing an error.

Commands I executed were:

sudo add-apt-repository ppa:chris-lea/node.js  
sudo apt-get update  
sudo apt-get install nodejs

and the error i was getting:

Invalid version 0.12.2
Line 299: curl not found in /bin/n

What I figured out was curl utility was not installed on my os.

I executed command:

apt-get install curl

(use sudo as prefix if you are not su)

and then repeated the steps suggest in answer and it work ;)

share|improve this answer

This one installs the latest node v0.12.* from nodesource.

sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.