Running Node.js on Wheezy

If you have a server that you are unable to install Debian versions higher than v7.x (code name Wheezy) due to a script dependence, old hardware or lack of time but still need to run Node.js, you must have already figured your options are quite limited.

Debian Node.js repositories for Wheezy are quite old for obvious reasons and maintainers’ choice of changing main node application name from “node” to “nodejs” seems to confuse some scripts. Binary installations of newer versions are also not easy to work with, at least not in my case. If you haven’t figured out already, compiling is your only way out.

Installing v6.x branch from source is possible; however, you’ll still need some modifications in your environment. Main problem is latest GCC version on Wheezy is v4.7.2 and Node.js requires v4.8.5 and up. To overcome this issue, Node.js team decided to build the packages below v6.x for Wheezy with clang-3.4. And, they maintain a compatible package for clang at their Node source repositories. So, first thing you need to do is to add their repos to your apt sources.

apt-get update
apt-get install curl apt-transport-https ca-certificates
echo "deb https://deb.nodesource.com/clang-3.4 wheezy main" >> /etc/apt/sources.list
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -

Then, install clang.

apt-get update
apt-get install clang-3.4

After that, download your Node.js v6.x branch source code tarball and unpack it. Before starting the build process, switch your compiler to the newly installed clang by applying these at the command line;

export CC=/usr/bin/clang
export CXX=/usr/bin/clang++

Carry on with ./configure and make, you should be able build Node.js and install it after the process completes.

This post is derived from the Node Source’s official description of the issue, which can be found here.