ebaauw / homebridge-music

Homebridge plugin for iTunes with AirPlay speakers
Apache License 2.0
92 stars 7 forks source link

0.2.19 crash Homebridge 0.4.53, thinking is 0.4.50 #20

Closed DJay-X closed 4 years ago

DJay-X commented 4 years ago

Hope you are well @ebaauw

I'm already running homebridge@0.4.53 a while now. Today I noticed that I can update your homebridge-music @0.2.18 -> @0.2.19, so I did.

Unfortunately homebridge was not running afterwards. Log is claiming I have not installed 0.4.53.

After going back to -music@0.2.18 everything is working again. However the log is still showing that I use hb 0.4.50

I hope you can help. Thx.

{
            "name": "iTunes",
            "service": "switch",
            "timeout": "25",
            "platform": "Music",
            "Script": "Music"
        },

Bildschirmfoto_2020-04-14_um_23_18_21

[4/14/2020, 11:08:23 PM] Got SIGTERM, shutting down Homebridge...
daniel@iMac ~ % sudo npm install -g --unsafe-perm homebridge@latest
Password:
/usr/local/Cellar/node/12.12.0/bin/homebridge -> /usr/local/Cellar/node/12.12.0/lib/node_modules/homebridge/bin/homebridge
+ homebridge@0.4.53
added 2 packages from 2 contributors and updated 8 packages in 3.787s
daniel@iMac ~ % homebridge                                         
[4/14/2020, 11:10:13 PM] Loaded config.json with 0 accessories and 2 platforms.
[4/14/2020, 11:10:13 PM] ---
[4/14/2020, 11:10:13 PM] Loaded plugin: homebridge-config-ui-x
[4/14/2020, 11:10:13 PM] Registering platform 'homebridge-config-ui-x.config'
[4/14/2020, 11:10:13 PM] ---
[4/14/2020, 11:10:13 PM] ====================
[4/14/2020, 11:10:13 PM] ERROR LOADING PLUGIN homebridge-music:
[4/14/2020, 11:10:13 PM] Error: Plugin /usr/local/Cellar/node/12.12.0/lib/node_modules/homebridge-music requires a HomeBridge version of ~0.4.53 which does not satisfy the current HomeBridge version of 0.4.50. You may need to upgrade your installation of HomeBridge.
    at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:56:11)
    at Server.<anonymous> (/usr/local/lib/node_modules/homebridge/lib/server.js:153:14)
    at Array.forEach (<anonymous>)
    at Server._loadPlugins (/usr/local/lib/node_modules/homebridge/lib/server.js:145:22)
    at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:57:24)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:32:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
[4/14/2020, 11:10:13 PM] ====================
[4/14/2020, 11:10:13 PM] Loading 2 platforms...
[4/14/2020, 11:10:13 PM] Error: The requested platform 'Music' was not registered by any plugin.
    at API.platform (/usr/local/lib/node_modules/homebridge/lib/api.js:134:13)
    at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:327:45)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:90:36)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
[4/14/2020, 11:10:13 PM] Got SIGTERM, shutting down Homebridge...
ebaauw commented 4 years ago
4/14/2020, 11:10:13 PM] Error: Plugin /usr/local/Cellar/node/12.12.0/lib/node_modules/homebridge-music requires a HomeBridge version of ~0.4.53 which does not satisfy the current HomeBridge version of 0.4.50. You may need to upgrade your installation of HomeBridge.

As you can see from the stack trace, this error is generated by Homebridge itself. It thinks it's v0.4.50. Homebridge Music simply gets the Homebridge version from Homebridge, through its API. I don't know where Homebridge Config UI X gets the version from. Are you running it standalone? Did you check for multiple installations of Homebridge on your server?

DJay-X commented 4 years ago

Thanks. I am just running one Homebridge on my iMac. And as shown in my log also reinstalled 0.4.53 again.

% sudo npm install -g --unsafe-perm homebridge@latest
Password:
/usr/local/Cellar/node/12.12.0/bin/homebridge -> /usr/local/Cellar/node/12.12.0/lib/node_modules/homebridge/bin/homebridge
+ homebridge@0.4.53
@iMac ~ % npm list -g --depth=0
/usr/local/Cellar/node/12.12.0/lib
+-- homebridge@0.4.53
+-- homebridge-config-ui-x@4.15.1
+-- homebridge-music@0.2.18
+-- n@6.3.1
`-- npm@6.14.4

Unfortunately I have no idea what else to do than this. If you have any suggestions I'm happy to follow your advise. Thanks.

ebaauw commented 4 years ago

You have a rather unusual path where you installed node, and, consequently, homebridge. Normally it's installed under /usr/local. Also note that the path suggests node v12.12.0, where you're running v12.16.1 according to Homebridge Config UI X. What does node -v report?

See my previous question: Are you running Homebridge Config UI X in standalone mode? It would seem in runs in a different environment than Homebridge.

How do you start homebridge?

DJay-X commented 4 years ago
@iMac ~ % which homebridge
/usr/local/bin/homebridge
@iMac ~ % which node
/usr/local/bin/node

For the installation on macOS I just followed this step-by-step instructions. https://github.com/homebridge/homebridge/wiki/Install-Homebridge-on-macOS

Homebridge is starting automatically by launchctl load ~/Library/LaunchAgents/com.homebridge.server.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>RunAtLoad</key>
        <true/>
    <key>KeepAlive</key>
        <true/>
    <key>Label</key>
        <string>com.homebridge.server</string>
    <key>ProgramArguments</key>
        <array>
             <string>/usr/local/bin/homebridge</string>
             <string>-I</string>
        </array>
    <key>StandardOutPath</key>
        <string>/Users/daniel/.homebridge/homebridge.log</string>
    <key>StandardErrorPath</key>
        <string>/Users/daniel/.homebridge/homebridge.log</string>
    <key>EnvironmentVariables</key>
        <dict>
        <key>PATH</key>
            <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
        <key>HOME</key>
            <string>/Users/daniel</string>
        </dict>
</dict>
</plist>

When I start homebridge in the terminal it is starting like this.

@iMac ~ % homebridge
[4/15/2020, 9:47:33 AM] Loaded config.json with 0 accessories and 2 platforms.
[4/15/2020, 9:47:33 AM] ---
[4/15/2020, 9:47:33 AM] Loaded plugin: homebridge-config-ui-x
[4/15/2020, 9:47:33 AM] Registering platform 'homebridge-config-ui-x.config'
[4/15/2020, 9:47:33 AM] ---
[4/15/2020, 9:47:33 AM] Loaded plugin: homebridge-music
[4/15/2020, 9:47:33 AM] Registering platform 'homebridge-music.Music'
[4/15/2020, 9:47:33 AM] ---
[4/15/2020, 9:47:33 AM] Loading 2 platforms...
[4/15/2020, 9:47:33 AM] [iTunes] Initializing Music platform...
[4/15/2020, 9:47:33 AM] [iTunes] homebridge-music v0.2.18, node v12.16.1, homebridge v0.4.50, macOS v10.15
[4/15/2020, 9:47:33 AM] [Config] Initializing config platform...
[4/15/2020, 9:47:33 AM] [Config] Spawning homebridge-config-ui-x with PID 12804
[4/15/2020, 9:47:33 AM] Loading 0 accessories...
[4/15/2020, 9:47:34 AM] [iTunes] waiting 25 seconds for Music to start
[4/15/2020, 9:47:37 AM] [Config] Homebridge Config UI X v4.15.1 is listening on :: port 8080
[4/15/2020, 9:47:59 AM] [iTunes] Initializing platform accessory 'iTunes'...
[4/15/2020, 9:47:59 AM] [iTunes] Initializing platform accessory 'Computer'...
[4/15/2020, 9:47:59 AM] [iTunes] Initializing platform accessory 'Apple TV 4K'...
[4/15/2020, 9:47:59 AM] [iTunes] Initializing platform accessory 'Schlafzimmer'...
[4/15/2020, 9:47:59 AM] [iTunes] Initializing platform accessory 'Schlafzimmer(Audio)'...
[4/15/2020, 9:47:59 AM] [iTunes] Initializing platform accessory 'Triby'...
[4/15/2020, 9:47:59 AM] [iTunes] Initializing platform accessory 'Wohnzimmer'...
[4/15/2020, 9:47:59 AM] [iTunes] Initializing platform accessory 'ZIPP 2'...
Setup Payload:
X-HM://00XXXXXXXXXXX
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ xxx-xx-xxx │     
    └────────────┘     

[4/15/2020, 9:47:59 AM] Homebridge is running on port 51843.

I don't know how multiple instances are created in the past. Definitely not with intention. How can I get rid of it? Sorry for my ignorance.

ebaauw commented 4 years ago

% which homebridge /usr/local/bin/homebridge

So that is a different installation. And if you do sudo which homebridge?

How can I get rid of it? Sorry for my ignorance.

I'd say sudo rm -rf /usr/local/Cellar/node/12.12.0, but I don't know what else depends on that. I'd also check what else is under /usr/local/Cellar.

DJay-X commented 4 years ago

And if you do sudo which homebridge?

@iMac ~ % sudo which homebridge
Password:
/usr/local/bin/homebridge

Bildschirmfoto 2020-04-15 um 22 43 39

And when I do sudo rm -rf /usr/local/Cellar/node/12.12.0 you think "the other" node 12.16.1 would take place automatically? It's showing when I do node -v v12.16.1 at the moment.

Do I have to reinstall Homebridge or any other? Just being prepared. :)

ebaauw commented 4 years ago

Homebridge seems to be running fine from the command line. It’s probably the service definition that’s wrong, or has the wrong environment. I don’t know the details of your installation. I’m sorry, but this is not related to Homebridge Music, I cannot help you any further.

DJay-X commented 4 years ago

Thanks for your time and patience. With your suggestions I'll try to delete some folders and maybe more or less, start from scratch installing node and the rest. Thanks again.