Beaglebone: Bonescript on Ubuntu, GPIO Pins not working

I have Ubuntu 13 and a beaglebone black. The ubuntu is from the beaglebone image section which I flashed onto the bone.

uname: Linux arm 3.8.13-bone21 #1 SMP Fri Jun 14 03:10:29 UTC 2013 armv7l armv7l armv7l GNU/Linux

I compiled nodejs from source and it’s version 0.10.18.

node -v : v0.10.18

I’m having a big problem installing bonescript. When I run “sudo node install -g bonescript” I get the following:

ubuntu@arm:~$ sudo npm install -g bonescript
[sudo] password for ubuntu:
npm http GET https://registry.npmjs.org/bonescript
npm http 304 https://registry.npmjs.org/bonescript

bonescript @ 0.2.3 preinstall /usr/local/lib/node_modules/bonescript
node-gyp clean || (exit 0); node-gyp configure build

make: Entering directory /usr/local/lib/node_modules/bonescript/build' CXX(target) Release/obj.target/misc/misc.o ../misc.cpp:1:0: warning: "BUILDING_NODE_EXTENSION" redefined [enabled by default] <command-line>:0:0: note: this is the location of the previous definition ../misc.cpp:21:27: error: variable or field ‘pollpri_event’ declared void ../misc.cpp:21:27: error: ‘EV_P_’ was not declared in this scope ../misc.cpp:21:46: error: expected primary-expression before ‘int’ ../misc.cpp:32:5: error: ‘ev_io’ does not name a type ../misc.cpp:148:31: error: ‘EV_P_’ has not been declared ../misc.cpp:148:43: error: expected ‘,’ or ‘...’ before ‘*’ token ../misc.cpp: In static member function ‘static void Pollpri::Init(v8::Handle<v8::Object>)’: ../misc.cpp:37:34: warning: statement has no effect [-Wunused-value] ../misc.cpp:38:38: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:47:33: warning: statement has no effect [-Wunused-value] ../misc.cpp: In constructor ‘Pollpri::Pollpri()’: ../misc.cpp:51:49: warning: statement has no effect [-Wunused-value] ../misc.cpp:54:18: error: ‘event_watcher’ was not declared in this scope ../misc.cpp:54:46: error: ‘ev_init’ was not declared in this scope ../misc.cpp:56:9: error: ‘ew’ was not declared in this scope ../misc.cpp: In destructor ‘virtual Pollpri::~Pollpri()’: ../misc.cpp:60:48: warning: statement has no effect [-Wunused-value] ../misc.cpp:63:20: error: ‘EV_DEFAULT_’ was not declared in this scope ../misc.cpp:63:33: error: ‘event_watcher’ was not declared in this scope ../misc.cpp:63:46: error: ‘ev_io_stop’ was not declared in this scope ../misc.cpp: In static member function ‘static v8::Handle<v8::Value> Pollpri::New(const v8::Arguments&)’: ../misc.cpp:67:32: warning: statement has no effect [-Wunused-value] ../misc.cpp:84:49: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:84:55: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:84:73: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:88:53: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:88:73: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:93:56: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:93:60: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:93:63: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:93:83: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:99:43: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:99:47: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:99:64: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:102:48: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:102:52: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:102:55: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:102:74: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:105:22: error: ‘class Pollpri’ has no member named ‘ew’ ../misc.cpp:105:32: error: ‘EV_READ’ was not declared in this scope ../misc.cpp:105:39: error: ‘ev_io_set’ was not declared in this scope ../misc.cpp:106:21: error: ‘EV_DEFAULT_’ was not declared in this scope ../misc.cpp:106:38: error: ‘ev_io_start’ was not declared in this scope ../misc.cpp:111:32: warning: statement has no effect [-Wunused-value] ../misc.cpp: In member function ‘void Pollpri::Event(Pollpri*, int)’: ../misc.cpp:117:57: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:117:61: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:117:67: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:118:23: error: ‘EV_READ’ was not declared in this scope ../misc.cpp:126:43: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:126:47: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:126:64: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:129:48: warning: left operand of comma operator has no effect [-Wunused-value] ../misc.cpp:129:52: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:129:55: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp:129:74: warning: right operand of comma operator has no effect [-Wunused-value] ../misc.cpp: In static member function ‘static void Pollpri::pollpri_event(int)’: ../misc.cpp:149:42: warning: statement has no effect [-Wunused-value] ../misc.cpp:150:44: error: ‘req’ was not declared in this scope ../misc.cpp:151:21: error: ‘revents’ was not declared in this scope ../misc.cpp:152:42: warning: statement has no effect [-Wunused-value] ../misc.cpp: In function ‘void init(v8::Handle<v8::Object>)’: ../misc.cpp:160:33: warning: statement has no effect [-Wunused-value] make: *** [Release/obj.target/misc/misc.o] Error 1 make: Leaving directory /usr/local/lib/node_modules/bonescript/build’
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.8.13-bone21
gyp ERR! command “node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “configure” “build”
gyp ERR! cwd /usr/local/lib/node_modules/bonescript
gyp ERR! node -v v0.10.18
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
ubuntu@arm:~$

Your getting a 304 error, so the problem is in trying to download bonescript from npmjs.org

When I just tried going to https://registry.npmjs.org/bonescript in my browser, Chrome complained about the certificate for that website, so my guess would be that npm defaults to some strict certificate checking.

Try installing from http://registr.npmjs.org/bonescript instead

I have Ubuntu 13 and a beaglebone black. The ubuntu is from the
beaglebone image section which I flashed onto the bone.

uname: Linux arm 3.8.13-bone21 #1 SMP Fri Jun 14 03:10:29 UTC 2013
armv7l armv7l armv7l GNU/Linux

I compiled nodejs from source and it's version 0.10.18.

node -v : v0.10.18

I'm having a big problem installing bonescript. When I run "sudo node
install -g bonescript" I get the following:

ubuntu@arm:~$ sudo npm install -g bonescript
[sudo] password for ubuntu:
npm http GET https://registry.npmjs.org/bonescript
npm http 304 https://registry.npmjs.org/bonescript

> bonescript @ 0.2.3 preinstall /usr/local/lib/node_modules/bonescript
> node-gyp clean || (exit 0); node-gyp configure build

make: Entering directory `/usr/local/lib/node_modules/bonescript/build'
  CXX(target) Release/obj.target/misc/misc.o
../misc.cpp:1:0: warning: "BUILDING_NODE_EXTENSION" redefined [enabled by
default]
<command-line>:0:0: note: this is the location of the previous definition
../misc.cpp:21:27: error: variable or field ‘pollpri_event’ declared void

Sounds like a libuv/libio incompatibility. I don't currently have an Ubuntu
image handy, but will download one. I'm working on removing the POLLPRI
entirely and replacing it with standard events using gpio-keys, but I am
adding auto-generation of PWM .dtbo files first, rather than relying on
anything in /lib/firmware.

I read somewhere that the bonescript in npm at that source isn’t compatible with 0.10.x so I downloaded the source for 0.8.25 and then did configure --without-snapshot && make && make installed. then I did npm install -g bonescript and it worked. I guess its a problem with bonescript compatability with 0.10.X and 0.9.X

I’m using this in my version 4 of the robot gardener by the way in case anyone is interested in helping me write a little code. www.RobotGardener.com Its an open source implementation of a smart greenhouse controller that will help people control and maintain their gardens.

Thanks for your help and I’ll contribute back what I can.

  • Sam