homebridge / HAP-NodeJS

Node.js implementation of the HomeKit Accessory Protocol (HAP)
Apache License 2.0
2.68k stars 630 forks source link

Errors Installing on a Raspberry Pi #7

Closed elvisimprsntr closed 10 years ago

elvisimprsntr commented 10 years ago

I have already successfully installed and launched HAP-NodeJS on a Ubuntu 14 VM

On the RPi, I have already performed the following:

root@raspberrypi:~/HAP-NodeJS# npm rebuild

> curve25519@1.0.0 install /root/HAP-NodeJS/node_modules/curve25519
> node-gyp rebuild

/usr/bin/env: node: No such file or directory

npm ERR! curve25519@1.0.0 install: node-gyp rebuild npm ERR! sh "-c" "node-gyp rebuild" failed with 127 npm ERR! npm ERR! Failed at the curve25519@1.0.0 install script. npm ERR! This is most likely a problem with the curve25519 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 curve25519 npm ERR! There is likely additional logging output above. npm ERR! npm ERR! System Linux 3.12.28+ npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "rebuild" npm ERR! cwd /root/HAP-NodeJS npm ERR! node -v v0.6.19 npm ERR! npm -v 1.1.4 npm ERR! code ELIFECYCLE npm ERR! message curve25519@1.0.0 install: node-gyp rebuild npm ERR! message sh "-c" "node-gyp rebuild" failed with 127 npm ERR! errno {} npm WARN This failure might be due to the use of legacy binary "node" npm WARN For further explanations, please read npm WARN /usr/share/doc/nodejs/README.Debian npm WARN npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /root/HAP-NodeJS/npm-debug.log npm not ok root@raspberrypi:~/HAP-NodeJS#

schlickspringer commented 10 years ago

check /usr/share/doc/nodejs/README.Debian ;) have you installed npm via apt-get or by source ? i recommend installing from sources...

elvisimprsntr commented 10 years ago

@schlickspringer source

Was able to get it to build after Installing nodejs-legacy

But get the following errors when launching via node Core.js

root@raspberrypi:~/HAP-NodeJS# node Core.js * WARNING * The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. * WARNING * Please fix your application to use the native API of Avahi! * WARNING * For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs * WARNING * The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. * WARNING * Please fix your application to use the native API of Avahi! * WARNING * For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister HAP-NodeJS starting...

/root/HAP-NodeJS/node_modules/node-persist/node-persist.js:91 var exists = fs.existsSync(options.dir); ^ TypeError: Object # has no method 'existsSync' at Object.initSync (/root/HAP-NodeJS/node_modules/node-persist/node-persist.js:91:21) at Object. (/root/HAP-NodeJS/Core.js:27:9) at Module._compile (module.js:446:26) at Object..js (module.js:464:10) at Module.load (module.js:353:32) at Function._load (module.js:311:12) at Array.0 (module.js:484:10) at EventEmitter._tickCallback (node.js:190:39) root@raspberrypi:~/HAP-NodeJS#

UPDATE: Manually installing node-persist...

  • npm install -g node-persist
  • npm rebuild

Still same error as above

schlickspringer commented 10 years ago

I think I had the same issue and therefore removed the debian nodejs (v0.6x) from rpi. try using precompiled rpi nodejs sources. the error with node binary not available should not be present when installing from sources.

elvisimprsntr commented 10 years ago

@schlickspringer Where do I get those and how to install?

schlickspringer commented 10 years ago

option a) compile yourself: http://elinux.org/Node.js_on_RPi or b) http://joshondesign.com/2013/10/23/noderpi

I used option b) because with the latest nodejs sources I had trouble with npm rebuild. the pre-compiled packages for rpi worked fine here although they are a bit behind...

elvisimprsntr commented 10 years ago

@schlickspringer For option a) is there a way to cross compile on x86?

UPDATE: Looks like v0.11.12 is the most current pre-complied. I followed the instructions to point to the pre-complied version, but still points to old version.

UPDATE2: Compiling from latest v0.10.33 stable (v0.10.25 is the default on Ubuntu 14 which HAP-NodeJS built and ran successfully) source so I can get everything installed. Stay tuned...

KhaosT commented 10 years ago

For Raspberry Pi, I used this precompiled NodeJS binary. http://node-arm.herokuapp.com/node_latest_armhf.deb

elvisimprsntr commented 10 years ago

Success. Woohoo!

  • wget http://node-arm.herokuapp.com/node_latest_armhf.deb
  • dpkg -i node_latest_armhf.deb
  • node -v
  • npm install -g node-gyp Not sure if this step was necessary
  • git clone https://github.com/KhaosT/HAP-NodeJS.git
  • cd HAP-NodeJS
  • npm rebuild
  • node Core.js

Thanks for all the help!

bonjour

WoodySlum commented 10 years ago

Same as @elvisimprsntr, issue solved on my side ...

elvisimprsntr commented 10 years ago
connyg commented 10 years ago

I have now 3 devices running, a lamp "window" (Licht Fenster), a lamp "cabinet" (Licht Schrankwand) and a power switch device "espresso machine" (Espressomaschine). All react to Siri commands, the lamps on "Licht" plus "Fenster" or "Schrankwand", the espresso machine in fact on "Espresso Maschine", very good. Quite nice to say "all devices off" and the two lamps and the espresso machine get switched off one after the other. Fun!

In the first try the window light wouldn't pair, I see that every time a pairing fails if the "Verify M5" is not performed. Then the device is orphaned and doesn't show up in the discovery nor in the device list. I needed to reset HomeKit config, uninstall/reinstall the app, restart the phone etc. to get back to normal. So the pairing process seems to be a bit fragile, currently can't see any factor influencing the failing of the pairing.

One thing that's disturbing now is that the HAP-NodeJS server would come up with "Start Verify M1" and "Start Verify M3" messages from time to time which take a few 10 seconds to complete. During that time the HAP server is little responsive, it would take quite long until a command to a device would be executed or sometimes not at all, Siri saying the device could not be reached. Attached a part of the log below, don't know if this helps.

HTTP response: 200

{"returnCode": true}

HTTP response: 200

{"returnCode": true}

Change: true

executed accessory: Espressomaschine, and characteristic: power switch, with value: true.

HTTP response: 200

{"returnCode": true}

Change: false

executed accessory: Espressomaschine, and characteristic: power switch, with value: false.

HTTP response: 200

{"returnCode": true}

Change: false

executed accessory: Licht Schrankwand, and characteristic: light service, with value: false.

Change: false

executed accessory: Licht Fenster, and characteristic: light service, with value: false.

Change: false

executed accessory: Espressomaschine, and characteristic: power switch, with value: false.

HTTP response: 200

{"returnCode": true}

HTTP response: 200

{"returnCode": true}

HTTP response: 200

{"returnCode": true}

Server Disconnected

Client Disconnected

Change: true

executed accessory: Licht Schrankwand, and characteristic: light service, with value: true.

Change: true

executed accessory: Licht Fenster, and characteristic: light service, with value: true.

Change: true

executed accessory: Espressomaschine, and characteristic: power switch, with value: true.

HTTP response: 200

{"returnCode": true}

HTTP response: 200

{"returnCode": true}

HTTP response: 200

{"returnCode": true}

New Session 64982

Server Connection Established 39102

Start Verify M1

Start Verify M3

Verify Success

Change: false

executed accessory: Espressomaschine, and characteristic: power switch, with value: false.

HTTP response: 200

{"returnCode": true}

Change: false

executed accessory: Licht Schrankwand, and characteristic: light service, with value: false.

Change: false

executed accessory: Licht Fenster, and characteristic: light service, with value: false.

HTTP response: 200

{"returnCode": true}

HTTP response: 200

{"returnCode": true}

Change: true

executed accessory: Licht Schrankwand, and characteristic: light service, with value: true.

Change: true

executed accessory: Licht Fenster, and characteristic: light service, with value: true.

HTTP response: 200

{"returnCode": true}

HTTP response: 200

{"returnCode": true}

Server Disconnected

Client Disconnected

Server Disconnected

Client Disconnected

New Session 64986

New Session 64987

Server Connection Established 59086

Server Connection Established 34817

Start Verify M1

Start Verify M1

Start Verify M3

Verify Success

Start Verify M3

Verify Success

Server Disconnected

Server Disconnected

Client Disconnected

Client Disconnected

New Session 64991

Server Connection Established 39110

Start Verify M1

New Session 49506

Server Connection Established 59089

Start Verify M1

Start Verify M3

Verify Success

Start Verify M3

Verify Success

Server Disconnected

Server Disconnected

Client Disconnected

Client Disconnected

Server Disconnected

Server Disconnected

Client Disconnected

Client Disconnected

New Session 64992

New Session 64993

Server Connection Established 59091

Server Connection Established 34822

Start Verify M1

Start Verify M1

Start Verify M3

Verify Success

New Session 49510

New Session 49511

Start Verify M3

Verify Success

Server Connection Established 39115

Server Connection Established 34824

Start Verify M1

Start Verify M1

Start Verify M3

Verify Success

Start Verify M3

Verify Success

Server Disconnected

Server Disconnected

Client Disconnected

Client Disconnected

New Session 64997

Server Connection Established 39117

Start Verify M1

Start Verify M3

Verify Success

New Session 49518

Server Connection Established 59096

Start Verify M1

Start Verify M3

Verify Success

Server Disconnected

Client Disconnected

Server Disconnected

Client Disconnected

New Session 65001

Server Connection Established 59097

Start Verify M1

New Session 65002

Server Connection Established 34828

Start Verify M1

Start Verify M3

Verify Success

Start Verify M3

Verify Success

Server Disconnected

Server Disconnected

Client Disconnected

Client Disconnected

elvisimprsntr commented 10 years ago

@kguess open a new issue if you want help, this one is closed.

connyg commented 10 years ago

Oops, sorry. Sent it by email and it was assigned to this issue here. Submitted it on the site now.

Am 08.11.2014 um 02:59 schrieb Elvis notifications@github.com<mailto:notifications@github.com>:

@kguesshttps://github.com/kguess open a new issue if you want help, this one is closed.

— Reply to this email directly or view it on GitHubhttps://github.com/KhaosT/HAP-NodeJS/issues/7#issuecomment-62240781.