alexba.in

A technical blog about open source hardware and software.

Installing NodeJS on Your RaspberryPi

| Comments

Here’s how I installed NodeJS on my RaspberryPi:

Upgrade to the latest OS / Firmware

If you have not already upgraded to the latest version of Raspbian OS and the latest RaspberryPi firmware, I recommend following my RaspberryPi Quickstart.

Getting and Compiling NodeJS

Once your RaspberryPi is up to date, here’s how to download and compile NodeJS:

# Install some prerequisites
sudo apt-get install python g++ make

# Grab the latest version of NodeJS
mkdir ~/nodejs && cd $_
wget -N http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz && cd `ls -rd node-v*`

# Compile and install to your RaspberryPi
./configure
make
sudo make install

Please note that it takes about two hours to compile NodeJS.

Confirming Installation

You can confirm that NodeJS was installed correctly by running:

node -v
npm --help

That’s it! You’re ready to begin development.

Additional Reading:

If you’d like to do some additional reading about NodeJS or ways to access the GPIO pins on the RaspberryPi, check out:

  • NodeJS - NodeJS home page
  • pi-gpio - “node.js based library to help access the GPIO of the Raspberry Pi”
  • GpiO - “Talk to your Raspberry Pi’s GPIO”

If you have any other recommended resources please let me know!

Comments