Node.js for the BeagleBone Black


To run node.js on the BeagleBone, it needs to be compiled from scratch or you can install a precompiled distribution available on the downloads page. While it seems to be more common to cross-compile for the ARM, I find it easier to natively compile it on the BeagleBone, but it does take a bit longer.

Note that I compile and install as root sudo su, so if you get any differing result, keep this in mind.


Step 1: Prerequisites

We will need a compiler to compile the node source. The build requires python for the configuration scripts and gcc for the actual code.

# apt-get install python
# apt-get install build-essential


Step 2: Download Node Source

Download the latest source code from the node.js website. At the time of writing it is version 0.10.5 so adjust this to the desired version. We will unpack it in the current directory. Specify the -C <path> option to extract it elsewhere.

# wget
# tar xzvf node-v0.10.5.tar.gz


Step 3: Configure

At the time of this writing, there is a problem with the Google V8 Snapshot feature causing node to segmentation fault. Snapshotting helps node start faster and is not a big-deal feature; we will just compile without it.

# cd node-v0.10.5
# ./configure --without-snapshot
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'arm_fpu': 'vfpv3',
                 'arm_neon': 0,
                 'armv7': 1,
                 'clang': 0,
                 'gcc_version': 47,
                 'host_arch': 'arm',
                 'node_install_npm': 'true',
                 'node_prefix': '',
                 'node_shared_cares': 'false',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_unsafe_optimizations': 0,
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'node_use_systemtap': 'false',
                 'python': '/usr/bin/python',
                 'target_arch': 'arm',
                 'v8_enable_gdbjit': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_use_arm_eabi_hardfloat': 'true',
                 'v8_use_snapshot': 'false'}}
creating  ./config.gypi
creating  ./


Step 4: Compile

We are ready to compile. It is going to take about a half-hour to complete — go get a cup of coffee.

# make


Step 5: Verify

Now that the build has finished, we can verify that all looks well before we install it.

# ./node -e 'console.log("het werkt!");'
# ./node -v


Step 6: Install

Now that all looks well, we are ready install it.

# make install
Posted in BeagleBone Black, HowTo Tagged with: