Skip to content

ERROR LOADING PLUGIN @homebridge-plugins/homebridge-matter #5

Closed

Description

@NebzHB

Describe The Bug:
Cannot load homebridge-matter in homebridge v2.0.2

To Reproduce:
Homebridge fresh install (not service mode) add homebridge-matter and try to run it

starting with : export AVAHI_COMPAT_NOWARN=1; /var/www/html/plugins/homebridge/core/class/../../resources/node_modules/homebridge/bin/homebridge.js -I --no-qrcode -U /var/www/html/plugins/homebridge/core/class/../../resources/homebridge >> /var/www/html/core/class/../../log/homebridge_daemon 2>&1 &

Expected behavior:
homebridge-matter to load :)

Logs:

[5/10/2026, 10:00:35 AM] Loaded config.json with 0 accessories and 3 platforms.
[5/10/2026, 10:00:35 AM] Loaded 1 cached accessories from cachedAccessories.
[5/10/2026, 10:00:38 AM] ---
[5/10/2026, 10:00:39 AM] Loaded plugin: homebridge-alexa@0.9.3
[5/10/2026, 10:00:39 AM] Registering platform 'homebridge-alexa.Alexa'
[5/10/2026, 10:00:39 AM] ---
[5/10/2026, 10:00:40 AM] Loaded plugin: homebridge-config-ui-x@4.80.0
[5/10/2026, 10:00:40 AM] Registering platform 'homebridge-config-ui-x.config'
[5/10/2026, 10:00:40 AM] ---
[5/10/2026, 10:00:40 AM] Loaded plugin: homebridge-gsh@4.0.3
[5/10/2026, 10:00:40 AM] Registering platform 'homebridge-gsh.google-smarthome'
[5/10/2026, 10:00:40 AM] ---
[5/10/2026, 10:00:40 AM] Loaded plugin: @homebridge-plugins/homebridge-camera-ffmpeg@4.1.0
[5/10/2026, 10:00:40 AM] Registering platform '@homebridge-plugins/homebridge-camera-ffmpeg.Camera-ffmpeg'
[5/10/2026, 10:00:40 AM] ---
[5/10/2026, 10:00:40 AM] ====================
[5/10/2026, 10:00:40 AM] ERROR LOADING PLUGIN @homebridge-plugins/homebridge-matter:
[5/10/2026, 10:00:40 AM] Error: Cannot find package 'homebridge' imported from /usr/lib/node_modules/@homebridge-plugins/homebridge-matter/dist/devices/RoboticVacuumAccessory.js
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:314:9)
    at packageResolve (node:internal/modules/esm/resolve:768:81)
    at moduleResolve (node:internal/modules/esm/resolve:855:18)
    at defaultResolve (node:internal/modules/esm/resolve:985:11)
    at ModuleLoader.#cachedDefaultResolve (node:internal/modules/esm/loader:731:20)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:310:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:182:49)
[5/10/2026, 10:00:40 AM] ====================

Plugin Config:

{
    "bridge": {
        "name": "hb",
        "username": "45:AE:AA:AA:AA:AA",
        "port": 51826,
        "pin": "031-45-154",
        "manufacturer": "hb",
        "model": "Homebridge",
        "serialNumber": "45:AE:AA:AA:AA:AA",
        "setupID": "AAAA",
        "advertiser": "bonjour-hap"
    },
    "description": "test",
    "platforms": [
        {
            "platform": "config",
            "name": "Config",
            "port": 33221,
            "auth": "form",
            "theme": "green",
            "tempUnits": "c",
            "lang": "auto",
            "sudo": true,
            "debug": false,
            "homebridgePackagePath": "/var/www/html/plugins/homebridge/core/class/../../resources/node_modules/homebridge/",
            "log": {
                "method": "file",
                "path": "/var/www/html/core/class/../../log/homebridge_daemon"
            },
            "accessoryControl": {
                "debug": false
            },
            "scheduledBackupDisable": true
        },
        {
            "name": "Homebridge Matter",
            "enableOnOffLight": false,
            "enableDimmableLight": false,
            "enableColourTemperatureLight": false,
            "enableExtendedColourLight": false,
            "enableOnOffOutlet": true,
            "enableOnOffSwitch": true,
            "enableGenericSwitch": true,
            "enableAirQualitySensor": false,
            "enableContactSensor": false,
            "enableLightSensor": false,
            "enableOccupancySensor": false,
            "enableTemperatureSensor": false,
            "enableHumiditySensor": false,
            "enableSmokeSensor": false,
            "enableLeakSensor": false,
            "enableDoorLock": false,
            "enableWindowBlind": false,
            "enableVenetianBlind": false,
            "enableThermostat": false,
            "enableFan": false,
            "enableRobotVacuum": false,
            "enablePowerStrip": false,
            "platform": "Matter"
        }
    ],
    "accessories": []
}

Environment:

  • Plugin Version: 1.4.0
  • Homebridge Version: 2.0.2
  • Node.js Version: 22.22.2
  • NPM Version: 10.9.7
  • Operating System: Debian 12

Activity

  1. bwp91 commented on Jul 12, 2026

    @bwp91
    Contributor

    Hi 👋 The log you posted stops just before the part that matters — the actual error for homebridge-matter isn't shown, so it's hard to say what went wrong.

    Could you please:

    1. Update to the latest version (v1.4.1, which includes updated dependencies) and try again.
    2. If it still fails, paste the full error block for homebridge-matter (the lines that start after Loaded plugin: @homebridge-plugins/homebridge-matter).
    3. Include your Node.js version (node -v).

    A couple of things worth checking, since your setup starts Homebridge with a custom command:

    • This plugin needs Node v22 or v24 — other versions are not supported and can cause exactly this kind of load error.
    • It also needs Homebridge v2 with Matter enabled — see Enabling Matter in the wiki.

    The full error will tell us which of these it is 🙂

  2. bwp91 commented on Jul 20, 2026

    @bwp91
    Contributor

    Apologies — my earlier reply was wrong. The error was in your log, I just missed it. Thank you for including it, because it pointed straight at a real bug.

    What was wrong

    The robotic vacuum file had a line that imported a value from the `homebridge` package itself. That made Node go looking for the `homebridge` package the moment the file was loaded.

    On a normal Homebridge UI install that lookup happens to succeed. On your setup it cannot: the plugin lives in /usr/lib/node_modules, while Homebridge lives in a completely separate folder under /var/www/html/plugins/homebridge/. Node has no path from one to the other, so the import failed.

    Because the plugin loads every accessory file at startup, that one failed import took down the whole plugin — not just the vacuum. That is exactly what you saw.

    The fix

    Released in v1.5.2. The value is now looked up only at the moment it is actually needed, instead of when the file loads, so the plugin no longer touches the homebridge package at startup at all.

    npm i -g @homebridge-plugins/homebridge-matter
    

    Please update and restart. It should load normally now.

    Two things still worth checking on your side, since they are separate requirements:

    • the plugin needs Node v22 or v24
    • it needs Homebridge v2 with Matter enabled — see Enabling Matter

    Your log shows Homebridge v2.0.2, so a bridge update is probably wise too. Let me know how you get on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions