#TIL: Hacks to Get Adafruit WebIDE Working

I recently reformatted my Raspberry Pi in an effort to start a project from scratch, but I’m having a heck of a time trying to get the Adafruit WebIDE installed. Here’s what I had to do.

I started by using berryboot, which is amazing – it’s a simple zip file that you extract onto a FAT-formatted SD card, and then insert into your RPi. Once it’s in there, it’ll boot up and (providing you have network access – it will let you connect to wifi if you have an adapter) allow you to download and install the OS of your choice. I picked Raspbian (a flavour of Debian).

That all went well. From there, you have a few different options to install WebIDE. You can curl the install.sh script from their git repo and execute that, you can download a debian package from Adafruit’s S3 storage, or you can install it all manually with a few steps. I tried all 3 and ran into issues with each one.

I really wanted the install script to work, since it also installs the WebIDE as a service – that way it would start up automatically every time I powered up the RPi, without needing to SSH into it and start it manually. Unfortunately, despite the success message at the end of the script, it didn’t seem to work. The Debian package gave me the same result.

I went down the path of installing everything by hand, which worked until I got to the “npm install” step. Turns out there’s some errors when NPM (the node package manager) tries to install some dependencies. At first, it was a “unable to find jade version 0.28.0” error. Turns out updating NPM fixed this right up.

After that, NPM tries to natively compile another package, pty.js – unfortunately, the version of node-gyp that gets installed when you update NPM requires a newer version of Node for it to work properly. At this point I could’ve either updated node manually or downgrade node-gyp to a version that was compatible with the “stable” version of node from the raspbian package manager – both a huge pain in the ass that will probably unearth other problems and incompatibilities.

Instead, I ended up wiping what I had did, reinstalling raspbian using BerryBoot, and I manually installed the latest compiled version of Node for the Raspberry Pi, which happens to be 0.10.26. I followed the instructions on Josh On Design’s page to install and set up node using this precompiled package, and then manually installed the Adafruit WebIDE from their git repo, making sure to skip the part that installs node from the package manager. All in all, after Raspbian was installed, I did the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
sudo apt-get update
sudo apt-get upgrade
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-arm-pi.tar.gz
tar -xvzf node-v0.10.26-linux-arm-pi.tar.gz
#this should spit out a version number
node-v0.10.26-linux-arm-pi/bin/node --version 

sudo nano ~/.profile
#add the following to the bottom of .profile
NODE_JS_HOME=/home/pi/node-v0.10.26-linxu-arm-pi
PATH=$PATH:$NODE_JS_HOME/bin
#save the file

#this reloads the profile, adding node to your path
source ~/.profile 
#this should spit out a version number, verifying that node is in your path
npm --version 
npm install -g node-gyp

sudo apt-get -y install build-essential redis-server git
git clone git://github.com/adafruit/Adafruit-WebIDE.git
cd Adafruit-WebIDE
mkdir tmp
npm config set tmp tmp

nano package.json  
#update the following line to version 1.4.7
"connect-redis": "1.4.7"
#save the file

npm install

nano config/config.js 
# change the port to something other than 80, I used 8000
"port": 8000
#save the file

node server.js

After all this, you should be able to browse to http://raspberrypi:8000 (or whatever port you chose) and see the Adafruit WebIDE (which will then prompt you to log into Bitbucket). Of course, this doesn’t set up the service, so you’ll have to manually type “node server.js” to start it after each reboot. Have fun!

Comments