dills122 / MTG-Card-Analyzer

Analyze images of MTG cards
MIT License
9 stars 3 forks source link

require() of ES Module not Supported #79

Open mewtwo532 opened 2 years ago

mewtwo532 commented 2 years ago

MTG-Card-Analyzer2 % node index.js scan ./src/test-images/PlatinumAngel.jpg node:internal/modules/cjs/loader:1152 throw err; ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /MTG-Card-Analyzer2/node_modules/meow/index.js from /MTG-Card-Analyzer2/index.js not supported. Instead change the require of /MTG-Card-Analyzer2/node_modules/meow/index.js in /MTG-Card-Analyzer2/index.js to a dynamic import() which is available in all CommonJS modules. at /MTG-Card-Analyzer2/index.js:2:18 at Object. (/MTG-Card-Analyzer2/index.js:64:3) { code: 'ERR_REQUIRE_ESM' }

Path prefix changed for privacy.

dills122 commented 2 years ago

For now you can checkout this commit 66cdfa3cba2ccbe1f8543a05440887bcdf376a78 to avoid the issue.

Looks like some bad updates got in master from dependabot.

dills122 commented 2 years ago

@mewtwo532 pull latest and let me know how it goes. Should be fixed up now.

mewtwo532 commented 2 years ago

The require is now resolved, thank you.

I am not encountering a issue when running your first test run command, it crashes, see attached file. This occurs when running with or without sudo.

System: 2021 Apple M1 MacBook Pro

output.txt

dills122 commented 2 years ago

Could you post the output in a comment on here?

I'm wondering if one of the dependencies is not built for ARM chips. I believe tesseract.js is a compiled library and the version currently in this project might not have ARM compiled binaries/files

mewtwo532 commented 2 years ago

I had posted the output as text then removed it cause of length, I have attached it as a text file to this comment. The error I am receiving however is the same as you have screen shot in #85

I tried pulling and running on my x86_64 Windows gaming machine, and received.

$ node index.js scan ./src/test-images/PlatinumAngel.jpg {"name":"MTG-Processor","hostname":"VR-Desktop","pid":21568,"level":30,"msg":"Creating Directory","time":"2022-03-13T23:22:55.232Z","v":0} {"name":"MTG-Processor","hostname":"VR-Desktop","pid":21568,"level":30,"msg":"Extracting Name","time":"2022-03-13T23:22:55.233Z","v":0} {"name":"MTG-Processor","hostname":"VR-Desktop","pid":21568,"level":30,"msg":"extract-text::ScanImage:: Scanning Card C:\Users\Gaming\AppData\Local\Temp\ada361fa-0977-458c-92a6-d47dd26f2445\efda47 ac-3843-456f-9db1-5e6f62fc0cb5./src/test-images/PlatinumAngel","time":"2022-03-13T23:22:55.577Z","v":0} Error: Callback was already called. at C:\Users\Gaming\MTG-Card-Analyzer\node_modules\async\dist\async.js:324:36 at C:\Users\Gaming\MTG-Card-Analyzer\src\image-processing\image-processor.js:40:20

output.txt