Homekit-bridged install problem

#1

Hi guys,

The good news is I've got my NR stuff running clean and fully functional. So my next step was to install homekit-bridged. After several install attempts that failed (and checking for solutions on the inter-web) I've run out of 'next thing to try'.

To install I've tried: sudo npm install node-red-contrib-homekit-bridged
and get an error message of:

node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.14.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/pi/.node-red/node_modules/zmq/build'
gyp ERR! stack at Error (native)

and the last attempt I tried using: sudo npm install -g --unsafe-perm node-red-contrib-homekit-bridged

and while I get no CLI errors, when I stop / restart NR I get this:

[node-red-contrib-homekit-bridged/homekit] Error: Module version mismatch. Expected 48, got 57.

Under 'manage palettes I can see "node-red-contrib-homekit-bridged' but it has a red exclamation error triangle and the 2 nodes shown are 'homekit-service' and 'homekit-bridge' but the boxes are grey with dashed outline.

Any thoughts?
ST

0 Likes

#2

you shouldn’t need to use sudo to install a contrib node, and adding -g is bad idea also.

Did you try using the command listed on the nodes readme on flows.nodered.org and also include the additional library the readme tells you is required?

Personally i would uninstall the version you installed with sudo and -g, then install the additional library and then try the command listed in the readme from the correct directory.

0 Likes

#3

Thanks. I hear you. Those are exactly the instructions I followed first. Installed the Libs. When they wouldn't work (repeatedly) I took the more drastic ones. I will try again I suppose but you know what they say about the definition of insanity.

0 Likes

#4

I assume you are using user pi? This time cut and paste the logs (if it fails) here.

0 Likes

#5

If you do really have to use sudo then you also need —unsafe-perm so that it doesn’t drop privileges when it calls the gyp step

0 Likes

#6

As an alternative you might try homebridge-mqtt
It works for months without any issues.

0 Likes

#7

Sooooo ... took me some time to remove (get rid of) homekit-bridged such that it no longer appeared under "manage palette". Kept getting the error about root not having access to 'dev dir "/root/.node-gyp/6.14.4" '. But having finally achieved that (tho I could not tell you what actually finally worked) and feeling I had now removed homekit, I tried to install homebridge-mqtt as suggested. The first command provided the following terminal output:

$ sudo npm install -g homebridge
/usr/bin/homebridge -> /usr/lib/node_modules/homebridge/bin/homebridge

curve25519-n@1.4.0 install /usr/lib/node_modules/homebridge/node_modules/curve25519-n
node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.14.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/homebridge/node_modules/curve25519-n/build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 4.9.35-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/homebridge/node_modules/curve25519-n
gyp ERR! node -v v6.14.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! curve25519-n@1.4.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the curve25519-n@1.4.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-10-25T18_06_30_009Z-debug.log2018-10-25T18_06_30_009Z-debug.log.txt (74.1 KB)

The *debug.log is attached. I have not yet gone to the 2nd command which is "sudo npm install -g homebridge-mqtt"

0 Likes

#8

BTW, for what it's worth, here is my dashboard. The result of everything NR does is a spoken message over the house speakers (5 zones). I had to rewire my Rpi3 (custom) i/f board (and recode) to give NR the ability to turn the house amp on when there was something to say because it turns out the amp draws 1.2a from my solar batteries just sitting there doing nothing. Now it's only on when it has to be.

The "Music Feed" switch however lets me turn the amp on when we have music going throughout the house, in which case if "Jessie" has something to say she will mute the music, say her piece, then turn the music back on. For example, when someone presses the door bell button, the music is muted and NR plays a snippet of Paul McCartney's "Someone's knockin' at the door". Very useful when we're out back listening to tunes. "Quiet Time" makes sure nothing comes over the speakers during the night (except the alarm system stuff).

0 Likes

#9

I don't think, this is the right place to get help for homebridge. But most important please read the homebridge documentation.

0 Likes

#10

.[quote="cflurin, post:9, topic:4267, full:true"]
I don't think, this is the right place to get help for homebridge. But most important please read the homebridge documentation.
[/quote]

My forum messages seek no information nor help with or about homebridge. This is about installing a package into NR and associated error messages. More than happy to read the homebridge documentation when it's installed, but since the first of the 2 instructions provided didn't work ...

0 Likes

#11

If you really need to install it globally with sudo then you also probably need the --unsafe-perm flag on the npm command so it doesn't drop privileges when it call node-gyp.

0 Likes

#12

Here https://github.com/nfarina/homebridge are all the steps you need to install homebridge.

0 Likes

#13

Hmmm. Thanks. I guess that's the problem with Linux (and Node Red on the internet). Plenty of recommendations, all different, never knowing which to follow and which to avoid cause it'll screw things up now, or later down the road. Do I use npm or nvm or apt-get or install through the palette manager or use sudo -g --unsafe or .... (a command that includes 'unsafe' is kind of daunting).

I'll try your second recommendation for installing it.

Why 'root' would not have access to one of its' own directories defies any kind of sensible logic (if not root, then who?). Same with putting the log file for the installation, you know, the documentation you are directed to go look if there's a problem, in a root directory (a dot root dir) where 95% of people would have no idea how to find it let alone figure out how to read it.

This is why Windows and Apple are such common O/S's and linux is not. Sure be nice to be able to click on an "install" button and just have it work, first time. I do not enjoy these Linux issues.

Nor BTW, do people want to spend 2 hours trying to find the exact, perfect, right forum to ask a question, before they can even begin to address their problem! Just sayin'.

I do thank you for your assistance however.
ST

0 Likes

#14

I would just like to point out that Homebridge is nothing to do with node-red. That is why it was suggested that this may not be the best place to ask for help with installing it, though those here have tried to help with that even so. Once you get it installed and wish Homebridge to interact with node-red in some way then that is a different matter of course.

0 Likes

#15

When you run npm to install a package it does allow calling out to helper apps - in this case it calls node-gyp which will try to recompile the binary bindings to suit the underlying os/hardware. As they don't know what the helper may do (as it's a third party bit of code) - npm tries to be "safe" - and when it realises it is running as root - it "drops privileges" of anything it calls (ie makes them not root) - so they can't do anything bad - hence node-gyp (and not npm), warning about not having access to things owned by root. By adding the --unsafe-perm flag you are telling npm that it's OK - you can run everything you call as root as well , which will let node-gyp then have access.

The installation docs on their page do say to use --unsafe-perm as well... https://github.com/nfarina/homebridge#readme

0 Likes

#16

Thanks guys. I had no idea homebridge had nothing to do with NR or that it was a third party product. Perhaps that explains why it doesn't come up under the install tab of the palette manager (although homekit and homekit-bridged do, which some may take to suggest that they are related and indigenous).

I appreciate your patience with me.
ST

1 Like

#17

I just tried installing the homekit-bridged red-node module, and I had the same error messages pop up. Here's what I had done wrong: I ran red-node as root (so sudo node-red-start instead of just node-red-start), and that lead to things being installed in the wrong places creating the permissions problems. Luckily I'm just starting with red-node (trying to move away from Home Assistant) and I only have a couple of nodes in my first pallet right now, so I re-ran as the user and I was able to install the module from inside the pallette manager with no errors.

If you're doing specifically just homebridge, not a node-red module.. then yeah, it's a different problem.

0 Likes