Install Node.js v0.8.2 on Raspbian

Perform the following steps to get Node.js v0.8.2 installed on Raspbian (The latest OS release for the Raspberry Pi)

Prep the system and get all the components needed to compile

sudo apt-get install git-core build-essential

Download the source and patch it

git clone https://github.com/gflarity/node_pi.git
git clone https://github.com/joyent/node.git
cd node
git checkout origin/v0.8.2-release -b v0.8.2-release
git apply --stat ../node_pi/v0.8.2-release-raspberrypi.patch

Set the flags needed for compilation

export GYP_DEFINES="armv7=0"
export CXXFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT'
export CCFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT'

Configure the compilation

./configure --shared-openssl --without-snapshot

Make & install

make
sudo GYP_DEFINES="armv7=0" CXXFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT' CCFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT' make install
l

Credits

https://github.com/gflarity/node_pi

Join the Conversation

10 Comments

  1. Thanks the instructions were very helpful, I was able to set up my RP. Make took about 2 hours. Before looking at your blog I was struggling with bunch of errors. Thanks again.

  2. Thanks for this. Had been trying to get node.js set up on the Pi for 3 days with no success. Much appreciated.

  3. I’m a bit stuck and could use some help making more progress.

    I can get this whole thing to work on one of three rpi os’s (raspbian) but when I run node command line I get an Illegal argument error and it exits. I did replace the line git checkout origin/v0.8.2-release -b v0.8.2-release
    with v0.8.7 instead using the command line as is gives an error:
    fatal: git checkout: updating paths is incompatible with switching branches.
    Did you intend to checkout ‘origin/v0.8.2-release’ which can not be resolved as commit?

    on the other two they both fail as follows one is raspbian and the other is the older squeeze but getting same error.
    File “./configure”, line 212
    ”’
    ^
    SyntaxError: invalid syntax

    any help is greatly appreciated.

  4. I too get the same error with the git checkout command.

    fatal: git checkout: updating paths is incompatible with switching branches.
    Did you intend to checkout ‘origin/v0.8.2-release’ which can not be resolved as commit?

    It seems there is something subtle wrong with that line in the instructions, but my git-fu is not good enough to enable me to diagnose it.

  5. Just to let you know, I have managed to get this working on Raspbian with 0.8.9, only significant change was:
    git checkout origin/v0.8.2-release -b v0.8.2-release

    becomes:
    git checkout origin/v0.8.9-release -b v0.8.9-release

  6. Make and install was failing for me with the default download if Raspbian, due to missing the openssl header.

    To fix this: `sudo apt-get install libssl-dev` needs to be done first to.

    Anyway, with the above node v0.8.15 is works.

Leave a comment

Your email address will not be published. Required fields are marked *