Closed felix-mcfly closed 6 years ago
What happens if you execute which homebridge
?
it says
pi@raspberrypi:~ $ which homebridge /usr/local/bin/homebridge
Could it be that you have another node/homebridge install in /usr/local/lib/node_modules?
how do I check this? sorry, I just clicked trough tutorials to get my homebridge working. I'm not very deep inside linux / raspberry pi.
What does ls /usr/local/lib/node_modules
print?
pi@raspberrypi:~ $ ls /usr/local/lib/node_modules homebridge homebridge-http npm
I open my config with
sudo pico ~/.homebridge/config.json
btw : how do I update my "first/real" homebridge if sudo npm install -g --unsafe-perm homebridge@latest
does not work?
Well you have two node/npm/homebridge installs in parallel on the Raspberry. homebridge looks for it's modules in /usr/local/lib/node_modules given that you installed it in /usr/local/bin.
What does which npm
print?
pi@raspberrypi:/usr/local/lib/node_modules/homebridge $ which npm print /usr/local/bin/npm /usr/bin/print
how do I delete the wrong one without killing my config? :D sorry for that.
Ok, it does not seem that it's installed twice. What does the npm config look like?
npm config list
pi@raspberrypi:~/.homebridge $ npm config list ; cli configs metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/5.5.1 node/v8.9.3 linux arm"
; globalconfig /usr/local/etc/npmrc prefix = "/usr"
; node bin location = /usr/local/bin/node ; cwd = /home/pi/.homebridge ; HOME = /home/pi ; "npm config ls -l" to show all defaults.
Run:
npm config set prefix /usr/local
After that you can update homebridge and everything else. Please note that all your plugins, that are currently in /usr/lib/node_modules
, are then unavailable. You need to reinstall those with the new prefix.
Finally I'd suggest to remove the wrong node_modules folder: sudo rm -rf /usr/lib/node_modules
okay I deleted the folder.
now I cant install anything..
pi@raspberrypi:/usr/lib/node_modules $ sudo npm install -g homebridge-sonybraviatv path.js:1182 cwd = process.cwd(); ^
Error: ENOENT: no such file or directory, uv_cwd
at Object.resolve (path.js:1182:25)
at Function.Module._resolveLookupPaths (module.js:416:17)
at Function.Module._resolveFilename (module.js:530:20)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.
What does sudo npm config list
tell you?
pi@raspberrypi:~ $ sudo npm config list ; cli configs metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/5.5.1 node/v8.9.3 linux arm"
; project config /home/pi/.npmrc prefix = "/usr/local"
; globalconfig /usr/local/etc/npmrc
; node bin location = /usr/local/bin/node ; cwd = /home/pi ; HOME = /root ; "npm config ls -l" to show all defaults.
pi@raspberrypi:~ $
Hmm strange. What does sudo npm config ls -l
print?
just did a reboot and I tried to update homebridge:
sudo npm install -g homebridge@latest
/usr/bin/homebridge -> /usr/lib/node_modules/homebridge/bin/homebridge
> mdns@2.3.4 install /usr/lib/node_modules/homebridge/node_modules/mdns
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.9.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/homebridge/node_modules/mdns/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/homebridge/node_modules/mdns/.node-gyp/8.9.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/homebridge/node_modules/mdns/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/homebridge/node_modules/mdns/.node-gyp/8.9.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/homebridge/node_modules/mdns/.node-gyp"
and so on and so on, I had to stop it via ctrl+c
sudo npm config ls -l prints:
pi@raspberrypi:~ $ sudo npm config ls -l ; cli configs long = true metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/5.5.1 node/v8.9.3 linux arm"
; project config /home/pi/.npmrc prefix = "/usr/local"
; globalconfig /usr/local/etc/npmrc ; prefix = "/usr" (overridden)
; default values access = null allow-same-version = false also = null always-auth = false auth-type = "legacy" bin-links = true browser = null ca = null cache = "/root/.npm" cache-lock-retries = 10 cache-lock-stale = 60000 cache-lock-wait = 10000 cache-max = null cache-min = 10 cafile = undefined cert = null cidr = null color = true commit-hooks = true depth = null description = true dev = false dry-run = false editor = "vi" engine-strict = false fetch-retries = 2 fetch-retry-factor = 10 fetch-retry-maxtimeout = 60000 fetch-retry-mintimeout = 10000 force = false git = "git" git-tag-version = true global = false global-style = false globalconfig = "/usr/local/etc/npmrc" globalignorefile = "/usr/local/etc/npmignore" group = 1000 ham-it-up = false heading = "npm" https-proxy = null if-present = false ignore-prepublish = false ignore-scripts = false init-author-email = "" init-author-name = "" init-author-url = "" init-license = "ISC" init-module = "/root/.npm-init.js" init-version = "1.0.0" json = false key = null legacy-bundling = false link = false local-address = undefined loglevel = "notice" logs-max = 10 ; long = false (overridden) maxsockets = 50 message = "%s" ; metrics-registry = null (overridden) node-version = "8.9.3" offline = false onload-script = null only = null optional = true otp = 0 package-lock = true parseable = false prefer-offline = false prefer-online = false prefix = "/usr/local" production = false progress = true proxy = null read-only = false rebuild-bundle = true registry = "https://registry.npmjs.org/" rollback = true save = true save-bundle = false save-dev = false save-exact = false save-optional = false save-prefix = "^" save-prod = false scope = "" script-shell = null scripts-prepend-node-path = "warn-only" searchexclude = null searchlimit = 20 searchopts = "" searchstaleness = 900 send-metrics = false shell = "/bin/bash" shrinkwrap = true sign-git-tag = false sso-poll-frequency = 500 sso-type = "oauth" strict-ssl = true tag = "latest" tag-version-prefix = "v" timing = false tmp = "/tmp" umask = 18 unicode = true unsafe-perm = false usage = false user = 1000 ; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden) userconfig = "/root/.npmrc" version = false versions = false viewer = "man"
So the sudo user is still trying to install everything into /usr/lib/node_modules. Run:
sudo npm config set prefix /usr/local
As for the gyp errors, that's unfortunately a more complicated story. Try rm -rf /root/.node-gyp
after trying to update homebridge I think it changed again to /node_modules.
pi@raspberrypi:~ $ sudo npm install -g homebridge@latest /usr/local/bin/homebridge -> /usr/local/lib/node_modules/homebridge/bin/homebridge
- homebridge@0.4.38 updated 3 packages in 5.545s pi@raspberrypi:~ $
/usr/local/bin and /usr/local/lib/node_modules do look good. Have you tried to install the other plugins?
pi@raspberrypi:~ $ sudo npm install -g homebridge-gpio-device
wiringpi-node@2.4.4 install /usr/local/lib/node_modules/homebridge-gpio-device/node_modules/wiringpi-node /bin/bash ./install.sh
Making libWiringPi ... ./install.sh: Zeile 28: ../../install.log: Keine Berechtigung ./install.sh: Zeile 29: ../../install.log: Keine Berechtigung failed.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wiringpi-node@2.4.4 install: /bin/bash ./install.sh
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wiringpi-node@2.4.4 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-03-26T22_14_24_928Z-debug.log
ANd with your plugin:
pi@raspberrypi:~ $ sudo npm install -g homebridge-dacp
> mdns@2.3.4 install /usr/local/lib/node_modules/homebridge-dacp/node_modules/mdns
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.9.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge-dacp/node_modules/mdns/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/homebridge-dacp/node_modules/mdns/.node-gyp/8.9.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge-dacp/node_modules/mdns/.node-gyp"
cant update node to run your plugin as well... :(
pi@raspberrypi:~ $ sudo npm install -g node@latest
> node@9.9.0 preinstall /usr/local/lib/node_modules/node
> node installArchSpecificPackage
npm ERR! path /root/.npm/_logs
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall scandir
npm ERR! Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm ERR! { Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm ERR! stack: 'Error: EACCES: permission denied, scandir \'/root/.npm/_logs\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'scandir',
npm ERR! path: '/root/.npm/_logs' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
The warnings from DACP could be ignored: Does it finish or does it keep failing?
For the wiringpi stuff: What does install.log tell you? cat install.log
Don't know where that file is though.
I think your node installation is totally messed up tbh.
Does /root/.npm/_logs exist? sudo ls -la /root/.npm/_logs
pi@raspberrypi:~ $ sudo ls -la /root/.npm/_logs
insgesamt 84
drwxr-xr-x 2 root root 4096 Mär 27 00:20 .
drwxr-xr-x 5 pi pi 4096 Mär 24 22:48 ..
-rw-r--r-- 1 root root 2505 Mär 24 22:50 2018-03-24T21_50_21_856Z-debug.log
-rw-r--r-- 1 root root 7644 Mär 27 00:06 2018-03-26T22_06_05_996Z-debug.log
-rw-r--r-- 1 root root 7643 Mär 27 00:07 2018-03-26T22_07_31_902Z-debug.log
-rw-r--r-- 1 root root 5177 Mär 27 00:07 2018-03-26T22_07_46_186Z-debug.log
-rw-r--r-- 1 root root 7727 Mär 27 00:08 2018-03-26T22_08_48_246Z-debug.log
-rw-r--r-- 1 root root 7727 Mär 27 00:09 2018-03-26T22_09_26_330Z-debug.log
-rw-r--r-- 1 root root 7728 Mär 27 00:14 2018-03-26T22_14_24_928Z-debug.log
-rw-r--r-- 1 root root 6226 Mär 27 00:18 2018-03-26T22_18_23_786Z-debug.log
-rw-r--r-- 1 root root 5927 Mär 27 00:19 2018-03-26T22_19_38_196Z-debug.log
-rw-r--r-- 1 root root 7727 Mär 27 00:20 2018-03-26T22_20_22_280Z-debug.log
pi@raspberrypi:~ $
Ok, you must've forgot to use sudo at some point. That's unfortunately one of the downsides of npm - I don't recommend to use sudo for npm at all.
Try this: sudo chown -R root:root /root
and run the ls command again.
that is very possible...
pi@raspberrypi:~ $ sudo chown -R root:root /root
pi@raspberrypi:~ $ sudo ls -la /root/.npm/_logs
insgesamt 84
drwxr-xr-x 2 root root 4096 Mär 27 00:20 .
drwxr-xr-x 5 root root 4096 Mär 24 22:48 ..
-rw-r--r-- 1 root root 2505 Mär 24 22:50 2018-03-24T21_50_21_856Z-debug.log
-rw-r--r-- 1 root root 7644 Mär 27 00:06 2018-03-26T22_06_05_996Z-debug.log
-rw-r--r-- 1 root root 7643 Mär 27 00:07 2018-03-26T22_07_31_902Z-debug.log
-rw-r--r-- 1 root root 5177 Mär 27 00:07 2018-03-26T22_07_46_186Z-debug.log
-rw-r--r-- 1 root root 7727 Mär 27 00:08 2018-03-26T22_08_48_246Z-debug.log
-rw-r--r-- 1 root root 7727 Mär 27 00:09 2018-03-26T22_09_26_330Z-debug.log
-rw-r--r-- 1 root root 7728 Mär 27 00:14 2018-03-26T22_14_24_928Z-debug.log
-rw-r--r-- 1 root root 6226 Mär 27 00:18 2018-03-26T22_18_23_786Z-debug.log
-rw-r--r-- 1 root root 5927 Mär 27 00:19 2018-03-26T22_19_38_196Z-debug.log
-rw-r--r-- 1 root root 7727 Mär 27 00:20 2018-03-26T22_20_22_280Z-debug.log
pi@raspberrypi:~ $
Now try the installs again from above - what happens?
just tried to update node, same issues as above..
Ok I'm almost out of ideas. Try installing nvm
using the instructions at: https://github.com/creationix/nvm and then try to reinstall node with nvm. There's examples down below on that page.
okay, got my homebridge back running with all plugins. got yout plugin installed with sudo npm install -g homebridge-dacp --unsafe-perm
now I got another problem, it needs node 9.3.0:
pi@raspberrypi:~ $ homebridge
*** WARNING *** The program 'node' 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=node>
*** WARNING *** The program 'node' 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=node&f=DNSServiceRegister>
[2018-3-27 01:19:52] Loaded plugin: homebridge-broadband
[2018-3-27 01:19:53] Registering accessory 'homebridge-broadband.Broadband'
[2018-3-27 01:19:53] ---
[2018-3-27 01:19:53] Plugin /usr/local/lib/node_modules/homebridge-dacp requires Node version of >=9.3.0 which does not satisfy the current Node version of v8.9.3. You may need to upgrade your installation of Node.
[2018-3-27 01:19:53] ====================
[2018-3-27 01:19:53] ERROR LOADING PLUGIN homebridge-dacp:
[2018-3-27 01:19:53] Error: Cannot find module '../build/Release/dns_sd_bindings'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-dacp/node_modules/mdns/lib/dns_sd.js:32:22)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
[2018-3-27 01:19:53] ====================
[2018-3-27 01:19:54] Loaded plugin: homebridge-edomoticz
tried to update note via http://thisdavej.com/upgrading-to-more-recent-versions-of-node-js-on-the-raspberry-pi/ but node -v shows 8.9.3. in anyway..
I think the installation of the mdns package in dacp failed. Did the dacp installation throw any errors? 8.9.3 should still work, even though I don't test with that version any longer.
Are you using nvm?
no error was printed.
nvm was nearly getting me to throw my PI and macbook out of the window - I didnt get how to install / reinstall the systemwide node, if I switched to a new node version via nvm, homebridge didn't run and all plugins were installed to some kind of "virtual path"
like: /home/pi/.nvm/versions/node/v9.9.0/lib/node_modules/homebridge-gpio-devic
Ok. The virtual path is the idea of nvm to fix permission issues like yours.
Anyhow, given this try uninstalling and reinstalling homebridge-dacp again. Something definitely broke while installing mdns as part of homebridge-dacp.
okay, after sitting in front of my pc until 4am I just reinstalled node 8.9.3 and everything workes again. I deleted
"engines": { "node": ">=9.3.0", "homebridge": ">=0.4.36"
out of packages.json and also your plugin started to work. thanks for your time and support!
Hey,
when I install homebridge-dacp and start homebridge I get this error:
I'm on homebridge 0.4.38:
thanks, felix