asednev / homebridge-plugin-govee

Govee H-series Thermometer Hygrometer plugin for Homebrige.
Apache License 2.0
53 stars 9 forks source link

Plugin v1.1.2 Fails to Run / Crashes - Error in Log after latest Node.Js and NPM updates #41

Closed SemoTech closed 2 years ago

SemoTech commented 2 years ago

Describe The Bug: Plugin fails after latest updates of Node.JS and NPM

Core error is:

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

To Reproduce: Restart Homebridge and see the log

Expected behavior: Plugin used to work.

Logs:

[31/10/2021, 12:17:10] ERROR LOADING PLUGIN homebridge-plugin-govee:
[31/10/2021, 12:17:10] Error: The module '/usr/local/lib/node_modules/homebridge-plugin-govee/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:1183: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/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[31/10/2021, 12:17:10] ====================

Plugin Config:

{
    "bridge": {
        "name": "Homebridge 0B0E",
        "username": "8D:B1:26:D1:0B:0E",
        "port": 51605,
        "pin": "552-54-814",
        "bind": [
            "eth0"
        ],
        "advertiser": "bonjour-hap"
    },
    "accessories": [
        {
            "delay": 5000,
            "disableSensor": false,
            "startOnReboot": false,
            "accessory": "DelaySwitch"
        }
    ],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "auto",
            "tempUnits": "f",
            "lang": "auto",
            "sessionTimeout": 86400000,
            "platform": "config"
        },
        {
            "controllers": [
                {
                    "address": "172.16.16.1",
                    "password": "secret",
                    "username": "secret"
                }
            ],
            "verboseFfmpeg": false,
            "platform": "UniFi Protect"
        },
        {
            "name": "Govee Hydrometer",
            "batteryThreshold": 25,
            "debug": false,
            "platform": "GoveeHomebridgePlugin"
        },
        {
            "bonds": [
                {
                    "ip_address": "172.16.16.162",
                    "token": "e93448df34bs15"
                }
            ],
            "include_dimmer": false,
            "include_toggle_state": false,
            "fan_speed_values": true,
            "platform": "Bond"
        },
        {
            "name": "Meross",
            "username": "secret",
            "password": "secret",
            "ignoreHKNative": true,
            "platform": "Meross"
        },
        {
            "name": "Govee",
            "username": "secret",
            "password": "secret",
            "apiKey": "372-sdgwadfsdg-9f4f-b3f6b0e9f69b",
            "platform": "Govee"
        }
    ],
    "disabledPlugins": []
}

Screenshots:

Environment:

asednev commented 2 years ago

@SemoTech Looks like there is an issue with npm dependencies. This plugin hasn't changed in 7 months. Did something change you your end? Perhaps you updated node. If that's the case, you can uninstall and reinstall the plugin through Homebridge.

SemoTech commented 2 years ago

Hi @asednev and thanks for the quick reply.

I think the point you just made that the plugin has not changed for 7 months is the issue, as it seems to be dependent on an older version of Node.Js based on the error log stating: "compiled against a different Node.js version using NODE_MODULE_VERSION 83. This version of Node.js requires NODE_MODULE_VERSION 93", and I am running the latest version. So to me that means the plugin needs to be re-compiled, no?

And just to further clarify, are you saying that if I uninstall and re-install homebridge-plugin-govee v1.1.2 it will be compatible with the latest Node.Js version 16.13.0, as it was complied for NODE_MODULE_VERSION 93?

Thank you.

asednev commented 2 years ago

I don't think Node 16 will work. I tried it several week ago and some of dependencies didn't support it.

I recommend going with Node 14 at this time.

SemoTech commented 2 years ago

@asednev thanks for confirming incompatibility with Node.JS 16.13.0.

Sadly I cannot downgrade as that would impact other plugins.

Since your plugin is 7 months old, are you not able to re-compile for "NODE_MODULE_VERSION 93" to keep it up-to-date?

Thank you.

asednev commented 2 years ago

@SemoTech Node compiles modules during npm install if necessary. As dependencies change, you should be able to take advantage of support for newer node modules.

Looking at the call stack:

[31/10/2021, 12:17:10] Error: The module '/usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/bluetooth_hci_socket.node'
was compiled against a different Node.js version using

The root of the problem is in @abandonware/bluetooth-hci-socket.

When time permits, I'll take a look if there's anything that I need to do with regard to dependencies.

SemoTech commented 2 years ago

That's greatly appreciated @asednev and glad you got to the bottom of it. Will wait to hear back when it is ready so I can re-try...

Thank you.

bwp91 commented 2 years ago

This same issue came up with my govee plugin. All you need to do is uninstall and reinstall the plugin.

sudo npm uninstall homebridge-plugin-govee -g
sudo npm install homebridge-plugin-govee -g
SemoTech commented 2 years ago

@bwp91 and @asednev,

I followed Ben's suggestion above to uninstall and re-install, and the govee plugin is working again!

Thank you both, problem solved!

bwp91 commented 2 years ago

I actually came on this repo to see if the H5177 was supported, got distracted by this issue 🤣

SemoTech commented 2 years ago

I actually came on this repo to see if the H5177 was supported, got distracted by this issue 🤣

So glad you did, you solved the problem!