Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.4.0 plugin fails to load, previous rev is fine. #20

Closed
ibmaster opened this issue Jan 29, 2022 · 9 comments
Closed

0.4.0 plugin fails to load, previous rev is fine. #20

ibmaster opened this issue Jan 29, 2022 · 9 comments

Comments

@ibmaster
Copy link

ERROR LOADING PLUGIN homebridge-eufy:
[1/29/2022, 9:52:37 AM] Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /usr/lib/node_modules/homebridge-eufy/node_modules/node-eufy-api/lib/index.js
require() of ES modules is not supported.
require() of /usr/lib/node_modules/homebridge-eufy/node_modules/node-eufy-api/lib/index.js from /usr/lib/node_modules/homebridge-eufy/lib/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename /usr/lib/node_modules/homebridge-eufy/node_modules/node-eufy-api/lib/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/lib/node_modules/homebridge-eufy/node_modules/node-eufy-api/package.json.

at new NodeError (internal/errors.js:322:7)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/usr/lib/node_modules/homebridge-eufy/lib/index.js:2:23)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
@sebmos
Copy link
Owner

sebmos commented Jan 29, 2022

What Node & NPM versions to you have?

@ibmaster
Copy link
Author

ibmaster commented Jan 29, 2022 via email

@sebmos
Copy link
Owner

sebmos commented Jan 30, 2022

I've published a change reverting the ES Module. Out of curiosity though - can you check what your homebridge-eufy version is?

@ibmaster
Copy link
Author

ibmaster commented Jan 30, 2022 via email

@sebmos
Copy link
Owner

sebmos commented Jan 30, 2022

Ah ok - I think from version 0.4.0 it would have worked, but this "ES module" reversal update should fix the issue again. ES module change is deferred to a major version update.

Let me know if it works!

@ibmaster
Copy link
Author

ibmaster commented Jan 30, 2022 via email

@sebmos
Copy link
Owner

sebmos commented Jan 30, 2022

Can you check what the version of node-eufy-api is? I think that would be in this file, based on the error message you posted: /usr/lib/node_modules/homebridge-eufy/node_modules/node-eufy-api/package.json

It looks to me like there's a mismatch between node-eufy-api and homebridge-eufy here, which is quite confusing!

@ibmaster
Copy link
Author

ibmaster commented Feb 1, 2022 via email

@ibmaster
Copy link
Author

ibmaster commented Feb 6, 2022

Deleted plugin entirely, and installed @ale770/homebridge-eufy v0.3.7
Now working again and it doesn't keep bugging me about the plugin being out of date :)
Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants