Kwintenvdb / homebridge-divoom

Apache License 2.0
15 stars 2 forks source link

Homebridge-divoom Nodejs 14.x #3

Open Marfre888 opened 3 years ago

Marfre888 commented 3 years ago

Hi @Kwintenvdb,

Thank you so much for this plugin, I was about the throw my Divoom away when I decided to check if someone came up with a homebridge plugin for it. I was so excited when I saw this.

I've managed to get it to run with nodejs 12.x, however, most of the other plugins have moved to 14.x and won't work properly with 12.x.

Would it be possible to recompile this plugin using 14.x

Thank you so much

Marfre888 commented 3 years ago

UPDATE

For anyone looking, I've managed to get it to work with Nodejs 14.x

This was my workaround.

  1. Starting from nodejs 14.x
  2. Downgrad nodejs to 12.x
  3. Instal plugin through Homebridge. It takes a while to install, and might even freeze up Homebridge, this is normal.
  4. After it is installed successfully, upgrade nodejs back to 14.x
  5. Homebridge will complain that 'bluetooth-serial-port' was compiled with a different version of nodejs and will not load the plugin
  6. Install 'sudo npm install -g node-bluetooth-serial-port', Which is this version (https://github.com/tinyprinter/node-bluetooth-serial-port)
  7. In package.json changed anything that says 'node-bluetooth-serial-port' to 'bluetooth-serial-port' (not sure if this step is required)
  8. Rename folder at '/usr/lib/node_modules' to 'bluetooth-serial-port'
  9. Lastly swap the folder 'bluetooth-serial-port' at '/usr/lib/node_modules/homebridge-divoom/node_modules' with the one at '/usr/lib/node_modules'
  10. Make sure all permissions are correct and restart. It should now load up properly.
Kwintenvdb commented 3 years ago

Hi there. Thanks for the detailed information.

I'll see if I can change the dependency to node-bluetooth-serial-port. I will probably also need to set the engine version in package.json to use version 14 and up of NodeJS, since version 12 is far too old already.

Marfre888 commented 3 years ago

Hi there. Thanks for the detailed information.

I'll see if I can change the dependency to node-bluetooth-serial-port. I will probably also need to set the engine version in package.json to use version 14 and up of NodeJS, since version 12 is far too old already.

Hi @Kwintenvdb,

Thank you for your message. Just fyi, the npm package of node-bluetooth-serial-port is something I manually published to npm, based on the files from the link above, to make it easy for me to install it, however, that means it might not be maintained.

If you could use the github link to update your package, I believe that would be a safer bet.

SafariKC commented 3 years ago

This is fantastic news. Before I dive in and do the version dance and file shuffle I'm curious if @Kwintenvdb has had a chance to make the dependency mods and give it a shot? I've been missing not having this, it's great to be able to turn on and off the Divoom with my lighting.

AvivWn commented 2 years ago

Hi there. I am having trouble to install the plugin for my homebridge. I tried to downgrade nodejs version to 12.0.0 and still the installation failed

The logs:

npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

> bluetooth-serial-port@2.2.7 install /usr/local/lib/node_modules/homebridge-divoom/node_modules/bluetooth-serial-port
> node-gyp configure build

gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/pi/.node-gyp/12.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge-divoom/node_modules/bluetooth-serial-port/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/homebridge-divoom/node_modules/bluetooth-serial-port/.node-gyp'
gyp ERR! System Linux 5.10.63-v7l+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /usr/local/lib/node_modules/homebridge-divoom/node_modules/bluetooth-serial-port
gyp ERR! node -v v12.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bluetooth-serial-port@2.2.7 install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bluetooth-serial-port@2.2.7 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!     /home/pi/.npm/_logs/2022-07-23T16_34_57_997Z-debug.log