jbree / homebridge-cec-accessory

Homebridge support for CEC devices over HDMI
MIT License
19 stars 6 forks source link

Strict Mode Needed #4

Closed Shugabuga closed 7 years ago

Shugabuga commented 7 years ago

Whenever HomeBridge is run the following error is thrown towards this plugin:

Partial: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Full:

[5/31/2017, 3:15:05 AM] ====================
[5/31/2017, 3:15:05 AM] ERROR LOADING PLUGIN homebridge-cec-accessory:
[5/31/2017, 3:15:05 AM] SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:413:25)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-cec-accessory/dist/controls/Power.js:7:11)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
[5/31/2017, 3:15:05 AM] ====================

Possible fix: Force strict mode?

jbree commented 7 years ago

Thanks for the report. Which version of nodejs are you running?

Want to try making the fix and see if it works? Happy to accept a PR.

LANtastic commented 7 years ago

After installing your plugin I ran exactly into the above mentioned error.

Running homebridge on a Raspberry Pi 2 Model B with Jessie. npm -v returns 5.3.0 node -v returns 4.2.1

I have no experience with Linux, so please be patient with me :)

jbree commented 7 years ago

@LANtastic, thanks for the report. I think the issue is with another package I made to support this plugin called cec-promise.

If you're comfortable editing a text file, you can edit the file /usr/local/lib/node_modules/cec-promise/index.js, and add a new line at the very top that says "use strict";

If you'd rather wait, I'll make the change this evening when I get home from work and publish it.

jbree commented 7 years ago

Version 0.1.1 should take care of this issue. Please confirm.

LANtastic commented 7 years ago

Sorry for late reply ! After updating the issue is solved and your plugin works like a charm :) THANKS !

jbree commented 7 years ago

Great! Take care