ebaauw / homebridge-lib

Utility Library for Homebridge Plugins
Apache License 2.0
94 stars 12 forks source link

Class constructor homebridgeLib cannot be invoked without 'new' #11

Closed gallarda closed 5 years ago

gallarda commented 5 years ago

Just upgraded homebridge-hue and added homebridge-lib like so:

npm -g i homebridge-lib homebridge-hue

Now when starting homebridge I get the following error:

[6/13/2019, 11:01:34 PM] Loaded plugin: homebridge-lib C:\Users\Doug\AppData\Roaming\npm\node_modules\homebridge\lib\server.js:171 plugin.initializer(this._api); ^

TypeError: Class constructor homebridgeLib cannot be invoked without 'new' at Server. (C:\Users\Doug\AppData\Roaming\npm\node_modules\homebridge\lib\server.js:171:14) at Array.forEach () at Server._loadPlugins (C:\Users\Doug\AppData\Roaming\npm\node_modules\homebridge\lib\server.js:145:22) at new Server (C:\Users\Doug\AppData\Roaming\npm\node_modules\homebridge\lib\server.js:57:24) at module.exports (C:\Users\Doug\AppData\Roaming\npm\node_modules\homebridge\lib\cli.js:32:16) at Object. (C:\Users\Doug\AppData\Roaming\npm\node_modules\homebridge\bin\homebridge:17:22) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

Do I need to modify my config.json for homebridge-lib?

This is on Windows 10 with homebridge@0.4.50 and node v10.16.0

Thanks!

ebaauw commented 5 years ago

Can you double-check that you don’t have an old version of homebridge-lib installed somewhere? See https://github.com/ebaauw/homebridge-hue/issues/485.

Do I need to modify my config.json for homebridge-lib?

No.

gallarda commented 5 years ago

I did an npm -g un homebridge-lib and npm un homebridge-lib before reinstalling. No difference.

I am going to look a little deeper. Seems that upgrading node to v10.16.0 might not have gone well.

Thanks for the quick reply. I will keep an eye on the issue in homebridge-hue as well

gallarda commented 5 years ago

I wiped out my entire node installation and started over from scratch. Same error.

ebaauw commented 5 years ago

I no longer have a Windows PC (since over 10 years), but I've been able to reproduce this issue on a Windows 10 VM under Parallels on my macBook. Windows uses \ in directories instead of /, causing homebridge-lib not to recognise that it's being loaded from homebridge.

Fixed in homebrdige-lib@4.2.8.

gallarda commented 5 years ago

I no longer have a Windows PC (since over 10 years), but I've been able to reproduce this issue on a Windows 10 VM under Parallels on my macBook. Windows uses \ in directories instead of /, causing homebridge-lib not to recognise that it's being loaded from homebridge.

Fixed in homebrdige-lib@4.2.8.

I am a Mac guy myself, so my PC is relegated to home server duty. Thanks so much for the quick bug fix!

I have confirmed that 4.2.8 fixes the issue on Windows 10.