benov84 / homebridge-chromecast-television

Homebridge Chromecast as Television
13 stars 1 forks source link

Error: Cannot find module 'hap-nodejs' #1

Closed oxplot closed 3 years ago

oxplot commented 3 years ago

Getting the following error on load:

[3/19/2021, 6:18:39 PM] ====================
[3/19/2021, 6:18:39 PM] ERROR LOADING PLUGIN homebridge-chromecast-television:
[3/19/2021, 6:18:39 PM] Error: Cannot find module 'hap-nodejs'
Require stack:
- /homebridge/node_modules/homebridge-chromecast-television/custom-characteristics.js
- /homebridge/node_modules/homebridge-chromecast-television/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/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:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/homebridge/node_modules/homebridge-chromecast-television/custom-characteristics.js:1:28)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
[3/19/2021, 6:18:39 PM] ====================

I'm running this on Homebridge 1.3.3 on Docker on Raspberry Pi4 aarch64

benov84 commented 3 years ago

I've published version homebridge-chromecast-television@1.0.1 with fix for this. Please, update to this version and check. Thank you!

oxplot commented 3 years ago

Unfortunately still the same error. This bit precedes the error:

Initializing HAP-NodeJS v0.9.3...
[3/20/2021, 12:35:19 PM] Loaded config.json with 0 accessories and 3 platforms.
[3/20/2021, 12:35:19 PM] Loaded 22 cached accessories from cachedAccessories.
[3/20/2021, 12:35:19 PM] ---
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
benov84 commented 3 years ago

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

I will update it again to make it work. 10x

oxplot commented 3 years ago

Thanks, this solved the error. However, it doesn't seem to discover my Chromecast Ultra. These are the only two log lines I get for this plugin:

[3/21/2021, 10:04:45 PM] [ChromecastTelevision] Initializing ChromecastTelevision platform...
...
[3/21/2021, 10:04:46 PM] [ChromecastTelevision] Searching for Chromecast devices
...
benov84 commented 3 years ago

Hi, because I don't have Chromecast Ultra I can't test and make it work straight away. If you want, I can tell you what to edit in the source code to try if it works and if it is okay, I will make public update with Chromecast Ultra support.

oxplot commented 3 years ago

Sure, I can take a look.

benov84 commented 3 years ago

Okay, thank you. Download and replace this file in your plugin folder. index.zip

benov84 commented 3 years ago

Hi, please update to version 1.03. There are new outputs in log: [3/24/2021, 10:32:17 PM] [ChromecastTelevision] Found device. Adding if supported: Google Home Mini [3/24/2021, 10:32:17 PM] [ChromecastTelevision] Found device. Adding if supported: Chromecast

Check if your device shows here, and if it shows, please send me the name. Thank you :)

oxplot commented 3 years ago

I'm getting:

[ChromecastTelevision] Found device. Adding if supported: Chromecast Ultra
benov84 commented 3 years ago

Update to version 1.0.4 and it should work.