AlexGustafsson / homebridge-wol

A Wake on Lan plugin for Homebridge
MIT License
301 stars 30 forks source link

Error Loading Plugin #39

Closed mpearon closed 6 years ago

mpearon commented 6 years ago

Backstory

New Install of HomeBridge on Ubuntu Server 16.04

Issue

Plugin not loading, causing error on accessory load. Removal of accessory

Environment

Configuration

My configuration looks like this:

{
    "bridge": {
        "name": "Homebridge",
        "username": "REDACTED",
        "port": REDACTED,
        "pin": "REDACTED"
    },
    "platforms": [
        {
            "platform": "Server",
            "name": "Homebridge Server",
            "port": REDACTED,
            "log": "systemd",
            "restart": "systemctl restart homebridge"
        },
        {
            "platform": "Wink2",
            "name": "WinkHub",
            "username": "REDACTED",
            "password": "REDACTED",
            "client_id": "REDACTED",
            "client_secret": "REDACTED",
            "direct_access": "true",
            "hide_groups": [],
            "hide_ids": [],
            "fan_ids": [
                "REDACTED"
            ]
        }
    ],
    "accessories": [
        {
            "accessory": "NetworkDevice",
            "name": "Server",
            "mac": "REDACTED",
            "ip": "REDACTED",
            "pingInterval": 60,
            "wakeGraceTime": 120,
            "shutdownGraceTime": 15,
            "shutdownCommand": "net rpc shutdown -I REDACTED -U REDACTED -f -t 120"
        }
    ]
}

Log

user@Homebridge:~$ homebridge -U /var/homebridge
[5/11/2018, 6:18:49 PM] Loaded plugin: homebridge-server
[5/11/2018, 6:18:49 PM] Registering platform 'homebridge-server.Server'
[5/11/2018, 6:18:49 PM] ---
[5/11/2018, 6:18:50 PM] Loaded plugin: homebridge-wink2
[5/11/2018, 6:18:50 PM] Registering platform 'homebridge-wink2.Wink2'
[5/11/2018, 6:18:50 PM] ---
[5/11/2018, 6:18:50 PM] ====================
[5/11/2018, 6:18:50 PM] ERROR LOADING PLUGIN homebridge-wol:
[5/11/2018, 6:18:50 PM] SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-wol/index.js:1:88)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
[5/11/2018, 6:18:50 PM] ====================
[5/11/2018, 6:18:50 PM] Loaded config.json with 1 accessories and 2 platforms.
[5/11/2018, 6:18:50 PM] ---
[5/11/2018, 6:18:50 PM] Loading 2 platforms...
[5/11/2018, 6:18:50 PM] [Homebridge Server] Initializing Server platform...
[5/11/2018, 6:18:50 PM] [WinkHub] Initializing Wink2 platform...
[5/11/2018, 6:18:50 PM] [WinkHub] Wink2 Init - Version 2.0.8
[5/11/2018, 6:18:50 PM] Loading 1 accessories...
/usr/local/lib/node_modules/homebridge/lib/api.js:64
      throw new Error("The requested accessory '" + name + "' was not registered by any plugin.");
      ^

Error: The requested accessory 'NetworkDevice' was not registered by any plugin.
    at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:64:13)
    at Server.str.replace.Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:264:42)
    at Server.str.replace.Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
mpearon commented 6 years ago

I upgraded to node 5.12.0, and the issue persists

AlexGustafsson commented 6 years ago

Could you try an even newer version of node such as the latest? Others have faced the same issue with “earlier” versions.

mpearon commented 6 years ago

Sorry @AlexGustafsson - I haven't forgotten about this. I'm struggling to get homebridge installed after upgrading to nodejs 10.x. Working from snapshots, so at least it is easy to blow it away and try again! I'll update this issue when I've gotten a little bit further along. I greatly appreciate your assistance!

AlexGustafsson commented 6 years ago

No worries, @mpearon. Good luck with getting homebridge installed again. Hopefully it won't be too much of a hassle.

mpearon commented 6 years ago

Sorry about the delay with this response. As it turns out, there was a rogue version of Node causing me grief. I used the which command to help me track it down.