Raspberry Pi Nodejs Open Zwave

sudo apt-get install make build-esential libudev-dev

mkdir open-wave wget https://github.com/OpenZWave/open-zwave/archive/master.zip

unzip master.zip

cd open-wave

make && sudo make install

if node-gyp is acting up, just remove and install again.

node i —save openzwave-shared

pi@beefypi ~/CODE/zwave-test $ npm i --save openzwave-shared npm http GET https://registry.npmjs.org/openzwave-shared npm http 304 https://regisry.npmjs.org/openzwave-shared npm http GET https://registry.npmjs.org/nan npm http 304 https://registry.npmjs.org/nan

openzwave-shared@1.0.1 install /home/pi/CODE/zwave-test/node_modules/openzwave-shared node-gyp rebuild

make: Entering directory '/home/pi/CODE/zwave-test/node_modules/openzwave-shared/build' CXX(target) Release/obj.target/openzwave_shared/src/openzwave.o In file included from ../src/openzwave.cc:18:0: ../src/openzwave.hpp:30:21: fatal error: Manager.h: No such file or directory compilation terminated. openzwave_shared.target.mk:102: recipe for target 'Release/obj.target/openzwave_shared/src/openzwave.o' failed make: * [Release/obj.target/openzwave_shared/src/openzwave.o] Error 1 make: Leaving directory '/home/pi/CODE/zwave-test/node_modules/openzwave-shared/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/node-v0.10.28-linux-arm-pi/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:807:12) gyp ERR! System Linux 3.18.7+ gyp ERR! command "node" "/opt/node-v0.10.28-linux-arm-pi/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/pi/CODE/zwave-test/node_modules/openzwave-shared gyp ERR! node -v v0.10.28 gyp ERR! node-gyp -v v0.13.0 gyp ERR! not ok npm ERR! openzwave-shared@1.0.1 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the openzwave-shared@1.0.1 install script. npm ERR! This is most likely a problem with the openzwave-shared package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls openzwave-shared npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.18.7+ npm ERR! command "/usr/bin/node" "/usr/bin/npm" "i" "--save" "openzwave-shared" npm ERR! cwd /home/pi/CODE/zwave-test npm ERR! node -v v0.10.28 npm ERR! npm -v 1.4.9 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/pi/CODE/zwave-test/npm-debug.log npm ERR! not ok code 0

After compiling open-zwave from source and installing the package, if I try to run test.js I get the following error:

node node_modules/openzwave-shared/test.js
loading up RELEASE addon: /home/pi/CODE/zwave-test/node_modules/openzwave-shared/lib/../build/Release/openzwave_shared.node

  Module._extensions[extension](this, filename);
Error: libopenzwave.so.1.3: cannot open shared object file: No such file or directory
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/pi/CODE/zwave-test/node_modules/openzwave-shared/lib/openzwave-shared.js:32:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

The solution is to sudo ldconfig