Using BeagleBone with JavaScript/Node.js

Hi,

I’m interested in looking at using BB with Node.js. If I come up with some test ideas, is it likely that I could find a production version of a board which would still allow me to use JavaScript or would I have to rewrite my solution with C or some C variant?

thanks

Please check out bonescript at http://beagleboard.org/Support/BoneScript .

Hi,

I’m interested in looking at using BB with Node.js. If I come up with some test ideas, is it likely that I could find a production version of a board which would still allow me to use JavaScript or would I have to rewrite my solution with C or some C variant?

You can use Node.js on any board version. There are no restrictions.

Irelandathome, I have personally installed Node.js from scratch and have had it working. On Debian before it was technically “supported” As said above, Bonescript runs on top ( along side ? Jason would know the best ) of Node.js.

There is only one hurdle when compiling from source. You need to tweak the build script to build for the given processor type. Also, it seems many of the javascript developers for Node.js modules are oblivious to the concept of multi ARCH software. So, it may be wise if you’re going to experiment on your own, that you backup your file system between each module install. At least this was the easiest way for me to keep a pristine ( clean ) file system.

All the major module like Express as far as I can tell seems to work fine though. I did have a problem with one of the older package managers initially while I was figuring things out. NPM worked fine last I looked though. Also, you may not be able to use the latest version, but personally I got very close( about a month back from latest ).

I have a command line log of the steps I took to achieve this if it’s of any interest.

William, I would be interested in seeing that log.

I couldn’t get Express to work in the Cloud9 IDE with a recent BBB Debian image.

apt-get install python build-essential
mkdir /nodejs
cd /nodejs

wget http://nodejs.org/dist/v0.10.15/node-v0.10.15.tar.gz

tar xzvf node-v0.10.15.tar.gz

cd node-v0.10.15

./configure --without-snapshot
make
./node -e ‘console.log(“Testing . . .”);’
make install
node -v
npm -v

This was compiled directly on the BBB using a NFS share for the rootfs. As we’re compiling directly on the BBB, it may be wise to consider using an NFS share for your rootfs while doing so ( lots of writting to disk ). You should be able to compile using an sdcard, but do so at your own risk. I would definitely advise not doing so on the eMMC if you care about it.

Another option would be to mount an NFS share at /home, then make absolutely sure you are compiling somewhere on that share. Information about how to achieve this is all over the web so I wont cover it( mounting /home from an NFS share that is ). An iSCSI or AoE mount would work fine too.

Oh, one more thing I forgot to mention. You may be able to get a newer version compiled and working on the BBB. But you’re on your own here. As I have not tested anythign newer yet. Well, not anything that I got working anyway.

So far I have Robert Nelsons bare-fs + node.js ( including npm ) and a few other utilities installed on my own BBB in as little as 156M. Adding Express should only add around 22M including all deps ( if i remember right ). So, if everything goes right it should be possible to have a Node.js based Web server running while using less than 200M worth of space.

Doe anyone have any suggested additions, or comments on the above ?

FWIW Mongoose, or MONGODB wouldnt install the last time I tested. However I would be willing to test again. Also FWIW, Express version I’ve been experimenter with is the latest 3.x version. Not 4.x

William, I would be interested in seeing that log.

I couldn't get Express to work in the Cloud9 IDE with a recent BBB Debian
image.

What did you try? If you open up a browser to point to the board
(without the :3000, ie. the default port 80), then you are looking at
a page served up via Express.

Installing cloud9 took the install all the way to 391M . . . wow. Yeah definitely going to have to think about that one.

Oh, and right before cloud9 i installed Express v3.x. Total rootfs size was 165M