renssies / homebridge-am43-blinds

A homebridge plugin to control the AM43 based blind motors in HomeKit
MIT License
18 stars 6 forks source link

Super confusing error and the plugin randomlyh stopped working #43

Open Jacksonbm1 opened 2 years ago

Jacksonbm1 commented 2 years ago

I had been getting:


 ====================
[7/15/2022, 11:53:12 PM] ERROR LOADING PLUGIN homebridge-am43-blinds:
[7/15/2022, 11:53:12 PM] Error: The module '/usr/lib/node_modules/homebridge-am43-blinds/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/bluetooth_hci_socket.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge-am43-blinds/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

So I tried uninstalling the plug in and reinstalling. That's when the real trouble started:

npm ERR! code 243
npm ERR! git dep preparation failed
npm ERR! command /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/homebridge/.npm --prefer-offline=false --prefer-online=true --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm ERR! code EACCES
npm ERR! npm ERR! syscall mkdir
npm ERR! npm ERR! path /usr/lib/node_modules/@abandonware
npm ERR! npm ERR! errno -13
npm ERR! npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@abandonware'
npm ERR! npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@abandonware'] {
npm ERR! npm ERR!   errno: -13,
npm ERR! npm ERR!   code: 'EACCES',
npm ERR! npm ERR!   syscall: 'mkdir',
npm ERR! npm ERR!   path: '/usr/lib/node_modules/@abandonware'
npm ERR! npm ERR! }
npm ERR! npm ERR! 
npm ERR! npm ERR! The operation was rejected by your operating system.
npm ERR! npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! npm ERR! 
npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! npm ERR! permissions of the file and its containing directories, or try running
npm ERR! npm ERR! the command again as root/Administrator.
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /home/homebridge/.npm/_logs/2022-07-16T05_33_46_980Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/homebridge/.npm/_logs/2022-07-16T05_33_30_242Z-debug-0.log

Operation failed. Please review log for details.

There were some issues with my npm having two separate installations, but I resolved those and still was getting the error.

I saw a few other bugs that told me to run it unsafe, so I ran: sudo npm install -g --unsafe-perm=true --allow-root homebridge-am43-blinds@0.3.0

This yielded:

npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/abandonware/noble.git
npm ERR! Warning: Permanently added the ECDSA host key for IP address '140.82.114.4' to the list of known hosts.
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-07-16T05_34_15_912Z-debug-0.log

The entire log file is massive and I can send it over later, but it looks like some weird git hub authentication. I'm starting to think there's an issue with abandonware or something. I have also tried: https://github.com/renssies/homebridge-am43-blinds/issues/40#issuecomment-987732496

anyone else facing this? Any solutions?

renssies commented 2 years ago

The first error you got was because noble (the Bluetooth package this plugin uses) is using bindings to communicate with bluetooth, however these bindings have to be recompiled every time you update node, even for minor versions.

The seconds errors you were getting were because something changed in NPM with install git packages, I've changed how @abandonware/noble is included in the package, this should solve the install issues.

However I've decided to officially deprecate the plugin because it's hard to get bluetooth working stable using either Node or Python, instead I'm now using a ESP32 based bridge. You can read more about it here: https://github.com/renssies/homebridge-am43-blinds/issues/41#issuecomment-1186548675

Jacksonbm1 commented 2 years ago

Hey, yeah I get that. Thanks for your support up till this point. Helped me support pretty janky shades for a year or so. Honesty, I just switched to the mqtt esp32 solution and it's just way more stable. I think pi's just seem to not do super well with Bluetooth and I don't think that's your fault. Noble is weird. Also, yeah am43 Bluetooth is pretty garbage. I ordered some zigbee am43 earlier and I'm happy that they're coming in even if I currently am stable.