tommasomarchionni / homebridge-openHAB

Homebridge plugin for openHAB
Apache License 2.0
49 stars 18 forks source link

TermostatItem.js:4 SyntaxError: Use of const in strict mode. #25

Closed jayekub closed 8 years ago

jayekub commented 8 years ago

after a fresh install of homebridge and homebridge-openhab via npm, i'm getting the follow error. the fact that an issue doesn't already exist for this must mean others don't get it? would love some guidance to figure out what it is about my environment that's causing this, and i'd be happy to contribute a fix if there's some way to make the plugin more robust in this case

/usr/local/lib/node_modules/homebridge-openhab/items/ThermostatItem.js:4 const EventEmitter = require("events"); ^^^^^ [Sun Apr 10 2016 18:40:59 GMT-0700 (PDT)] ==================== [Sun Apr 10 2016 18:40:59 GMT-0700 (PDT)] ERROR LOADING PLUGIN homebridge-openhab: [Sun Apr 10 2016 18:40:59 GMT-0700 (PDT)] SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/usr/local/lib/node_modules/homebridge-openhab/libs/ItemFactory.js:15:26) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) [Sun Apr 10 2016 18:40:59 GMT-0700 (PDT)] ==================== [Sun Apr 10 2016 18:40:59 GMT-0700 (PDT)] No plugins found. See the README for information on installing plugins.

a quick attempt at changing the 'const' to 'var' allows the plugin to load, but then it immediately crashes like so:

[Sun Apr 10 2016 18:49:10 GMT-0700 (PDT)] Homebridge is running on port 51826.

events.js:72 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE at errnoException (net.js:901:11) at Server._listen2 (net.js:1039:14) at listen (net.js:1061:10) at Server.listen (net.js:1135:5) at EventedHTTPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:58:19) at HAPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:155:20) at Bridge.Accessory.publish (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:479:16) at Server._publish (/usr/local/lib/node_modules/homebridge/lib/server.js:92:16) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:82:10) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)

jayekub commented 8 years ago

crap. obviously upon re-reading the second error i realized i just had another homebridge process already running. killing that fixed it, and then i was able to remove my modification to ThermostatItem.js after ensuring nodejs was updated to stable. versionitis i guess, nevermind me!