vojtamolda/homebridge-ecobee3-sensors

Error on install

Closed this issue · 4 comments

I am getting the following error after instalation..

[12/12/2021, 8:01:27 AM] ====================
[12/12/2021, 8:01:27 AM] ERROR INITIALIZING PLUGIN homebridge-ecobee3-sensors:
[12/12/2021, 8:01:27 AM] Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/lib/node_modules/homebridge-ecobee3-sensors/node_modules/chalk/source/index.js from /usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js not supported.
Instead change the require of index.js in /usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js:4:13)
at Plugin.module.exports [as pluginInitializer] (/usr/lib/node_modules/homebridge-ecobee3-sensors/index.js:11:18)
at Plugin.initialize (/usr/lib/node_modules/homebridge/lib/plugin.js:147:21)
at PluginManager.initializePlugin (/usr/lib/node_modules/homebridge/lib/pluginManager.js:91:26)
at PluginManager.initializeInstalledPlugins (/usr/lib/node_modules/homebridge/lib/pluginManager.js:83:24)
at async Server.start (/usr/lib/node_modules/homebridge/lib/server.js:106:9)
[12/12/2021, 8:01:27 AM] ====================

I'm getting the same:
Node.js v16.13.1
Homebridge v1.3.8

[12/20/2021, 3:24:09 PM] Loaded plugin: homebridge-ecobee3-sensors@0.1.7
Homebridge API version: 2.7
[12/20/2021, 3:24:09 PM] ====================
[12/20/2021, 3:24:09 PM] ERROR INITIALIZING PLUGIN homebridge-ecobee3-sensors:
[12/20/2021, 3:24:09 PM] Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/lib/node_modules/homebridge-ecobee3-sensors/node_modules/chalk/source/index.js from /usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js not supported.
Instead change the require of index.js in /usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js:4:13)
at Plugin.module.exports [as pluginInitializer] (/usr/lib/node_modules/homebridge-ecobee3-sensors/index.js:11:18)
at Plugin.initialize (/usr/lib/node_modules/homebridge/lib/plugin.js:147:21)
at PluginManager.initializePlugin (/usr/lib/node_modules/homebridge/lib/pluginManager.js:91:26)
at PluginManager.initializeInstalledPlugins (/usr/lib/node_modules/homebridge/lib/pluginManager.js:83:24)
at async Server.start (/usr/lib/node_modules/homebridge/lib/server.js:106:9)
[12/20/2021, 3:24:09 PM] ====================

Need to edit line 21 of the package.json file to "chalk": "=1.1.1"

Thanks. Forcing chalk version helped:
npm install -g homebridge-ecobee3-sensors chalk@1.1.1

PR sent. I have not really tested it, but should work

Fixed by #36. Thanks, @jkalamarz