homebridge-broadlink-rm icon indicating copy to clipboard operation
homebridge-broadlink-rm copied to clipboard

[Fixable] ERROR LOADING PLUGIN homebridge-broadlink-rm: Cannot find module 'hap-nodejs'

Open benncarroll opened this issue 4 years ago • 8 comments

Hey Luke,

First off just want to say huge thank you from me and everyone who uses your amazing plugin!

I am getting the following error casuing homebridge to crash on launch, after upgrading homebridge-broadlink-rm to v3.6.22

ERROR LOADING PLUGIN homebridge-broadlink-rm
Error: Cannot find module 'hap-nodejs'
Require stack:
 - /usr/lib/node_modules/homebridge-broadlink-rm/node_modules/homebridge-platform-helper/dist/accessory.js
 - /usr/lib/node_modules/homebridge-broadlink-rm/node_modules/homebridge-platform-helper/dist/index.js
 - /usr/lib/node_modules/homebridge-broadlink-rm/platform.js
 - /usr/lib/node_modules/homebridge-broadlink-rm/index.js

Then further down, as a result of the above:

Error: The requested platform 'BroadlinkRM' was not registered by any plugin
...
Got SIGTERM, shutting down Homebridge...

I believe a dependency 'homebridge-platform-helper' is missing a dependency of 'hap-nodejs'

As below, it can be fixed by manually installing this package.

Thanks again!

People looking for a quick fix!

Run the following command to install hap-nodejs manually and allow the plugin to run.

npm i -g hap-nodejs

benncarroll avatar Mar 14 '20 12:03 benncarroll

Forgot to add my versions & details:

  • homebridge 0.4.52
  • node v12.16.1
  • homebridge-broadlink-rm 3.6.22

benncarroll avatar Mar 14 '20 12:03 benncarroll

Hi, @lprhodes I've got the same issue too, hap-nodejs installation doesn't helped me.

asafdavid230 avatar Mar 28 '20 12:03 asafdavid230

I am in the same boat with asafdavid230

fizulnizam avatar Apr 10 '20 14:04 fizulnizam

I have the same issue as benncarroll and asafdavid230 even after installing hap-nodesjs manually

rfroom avatar Apr 16 '20 01:04 rfroom

Hap-nodjes must not be added as a dependency by a homebridge plugin. It must always use the instance passed by the Homebridge API

Supereg avatar Apr 17 '20 10:04 Supereg

So how do we solve this? @Supereg

fizulnizam avatar Apr 17 '20 12:04 fizulnizam

Homebridge api object has the hap property where everything from hap-nodejs is exposed. This is just something the author must fix in his code.

Supereg avatar Apr 18 '20 05:04 Supereg

I'm having the same issue, Homebridge crashes after I include the broadlink config, then I get the following error. Any ideas of a workaround? @lprhodes

[8/16/2020, 07:36:44] ERROR LOADING PLUGIN homebridge-broadlink-rm:
[8/16/2020, 07:36:44] Error: Cannot find module 'hap-nodejs'
Require stack:
- /usr/local/lib/node_modules/homebridge-broadlink-rm/node_modules/homebridge-platform-helper/dist/accessory.js
- /usr/local/lib/node_modules/homebridge-broadlink-rm/node_modules/homebridge-platform-helper/dist/index.js
- /usr/local/lib/node_modules/homebridge-broadlink-rm/platform.js
- /usr/local/lib/node_modules/homebridge-broadlink-rm/index.js
- /usr/local/lib/node_modules/homebridge/lib/plugin.js
- /usr/local/lib/node_modules/homebridge/lib/pluginManager.js
- /usr/local/lib/node_modules/homebridge/lib/api.js
- /usr/local/lib/node_modules/homebridge/lib/server.js
- /usr/local/lib/node_modules/homebridge/lib/cli.js
- /usr/local/lib/node_modules/homebridge/bin/homebridge
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-broadlink-rm/node_modules/homebridge-platform-helper/src/accessory.ts:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
[8/16/2020, 07:36:44] ====================

jeylites avatar Aug 15 '20 23:08 jeylites