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

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

v0.6.19

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

3 Answers 3

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
3  
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. –  bigbadonk420 Feb 27 at 16:21

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 at 12:38

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:

https://www.digitalocean.com/community/articles/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps

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 at 14:30
    
Apologies for my noobness. Updated answer –  amnah Mar 31 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 at 3:35

Your Answer

 
discard

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.