Hacker News new | ask | show | jobs
by sp332 4466 days ago
You can build a newer version from an official Ubuntu source package. Start by adding a line to a file in /etc/apt/apt.conf.d/ that pins all your packages to 12.04, "precise":

  APT::Default-Release "precise";
Then add a line to your /etc/apt/sources.list to include saucy (or trusty), which has the right version of node.

  deb http://archive.ubuntu.com/ubuntu saucy main restricted universe
  deb-src http://archive.ubuntu.com/ubuntu saucy main restricted universe
Saucy won't be supported after this year. You can either use Trusty now, or wait for Trusty to be officially released next month and then switch.

Next, run these:

  sudo apt-get update
  sudo apt-get build-dep -t saucy nodejs
  sudo apt-get -b source -t saucy nodejs
This puts the packages in the current directory. Now just install the one(s) you want:

  dpkg -i nodejs_0.10.15~dfsg1-4_amd64.deb
Edit: wow, I just noticed how many packages that build-dep step pulls in. I hope that doesn't step on anything important :( At that point, you might as well just add a file /etc/apt/preferences.d/01node with these lines:

  Package: nodejs
  Pin: release n=saucy
  Pin-Priority: 1000
Then "apt-get install nodejs" will get the right version and all dependencies, no need to build from source.