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.

How do I install node.js in Ubuntu? I've been looking around, and I can't find anything. Is there a Ubuntu package for node.js, or do I have to compile it myself?

share|improve this question
You can also update node.js with npm davidwalsh.name/upgrade-nodejs –  user284127 May 22 '14 at 7:54

6 Answers 6

up vote 93 down vote accepted

You can use this node.js PPA:

ppa:chris-lea/node.js Launchpad logo (Click here for instructions on using PPAs.)

If you're on Ubuntu Server, first do this:

sudo apt-get install python-software-properties

Then, do this:

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

Then, you have the latest version of node.js installed.

share|improve this answer
12.10 now includes this so you can just run sudo apt-get install nodejs –  hafichuk Oct 24 '12 at 16:12
@hafichuk you've been able to do that for a few cycles now - however, getting it straight from the source (Official PPA) means you'll get better support and security updates. –  jrg Oct 25 '12 at 0:36
Remember to run sudo apt-get update && sudo apt-get install python-software-properties if you are on ubuntu-server –  Kieran Andrews Apr 2 '13 at 2:37
@hafichuk: not the latest one though, which causes incompatibility errors while installing modules using npm –  vartec Oct 23 '13 at 12:31
@vartec correct. –  jrg Oct 23 '13 at 12:34

Yes, go to Synaptic, search for "nodejs". The packages are located in the universe repository. I suggest you install all of the packages starting with nodejs if you are doing development.

Just in case that doesn't work:

sudo apt-get install g++ curl libssl-dev apache2-utils git-core
git clone git://github.com/joyent/node.git
cd node
sudo make install

That will download the sourcecode of node.js, make it and install it.

share|improve this answer
Wouldn't "sudo apt-get build-dep nodejs" be more appropriate than your "apt-get install" line? –  freddyb Jun 18 '11 at 16:10
@freddyb Doesn't hurt to have it like this. –  nickguletskii Jun 18 '11 at 16:20
Thanks for your answer - however, I recently discovered that node.js has a "officially unofficial" PPA - so I answered with that, since it wouldn't be polite to rewrite your entire answer with the "correct" instructions. –  jrg Nov 28 '11 at 1:23
However I prefer this solution instead of sudo apt-get install nodejs, this last doesn't give you the latest version. –  Rubens Mariuzzo Jan 12 '13 at 19:28
@rubens not if you use the PPA I describe above. –  jrg Oct 23 '13 at 12:35

Node is one of the easier projects to build. Just change the version as that continues to change.

$ cd /usr/local/src
$ wget http://nodejs.org/dist/v0.8.21/node-v0.8.21.tar.gz
$ tar -xvzf node-v0.8.21.tar.gz
$ cd node-v0.8.21
$ ./configure
$ make
$ sudo make install
$ which node

You should see /usr/local/bin/node.

share|improve this answer
Tested on Ubuntu 14.04 LTS with Node.js v0.10.30 and it worked perfectly. To get the most recent release, go to nodejs.org/download. To see all releases: github.com/joyent/node/releases. –  Lucio Paiva Aug 9 '14 at 15:12
To whom it may concern, NPM will also be built and installed automatically. –  Lucio Paiva Aug 9 '14 at 15:16

Use NVM which allows you to use multiple versions of Node and without sudo.

It is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities.

It downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you.


curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
source ~/.nvm/nvm.sh

# May take a while if compilation required:
nvm install 0.9.0
nvm install 0.9.9

node use 0.9.0
node --version
node use 0.9.9
node --version

Since the sourcing has to be done for every new shell, you will probably want to:

echo 'source ~/.nvm/nvm.sh
nvm use 0.9.9 &>/dev/null
' >> ~/.bashrc
share|improve this answer

Chris Lea PPA offers the most updated compiled version of Node.js.

Whom (and how) could I beg to maintain official "universe" version of Node.js as updated as Chris Lea's version?

I'd like to install official package from official repositories...Maybe it's a sillyness, but doing this gives me a feeling that there's more than just one person behind the future maintenance of the package.


share|improve this answer
Looks like he can't put it into the repositories. twitter.com/chrislea/status/351941395893862402 also, he works for mediatemple, and there have been talks of an official nodejs ppa, just like there is for nginx. –  jrg Jul 4 '13 at 1:02

I am always leery of using a non-official PPA - it usually works out, but I like there to be some level of official association between the distribution channel and the project that I am using...

Personally, this is the best bang for my buck when it comes to a resource for the many good ways to install Node - https://gist.github.com/isaacs/579814

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.