Reputation: 301
I run a node script on windows 11 and I am usig node-tesseract-ocr for reading text content of a png file
const tesseract = require("node-tesseract-ocr");
const fs = require("fs/promises");
async function main() {
const img = await fs.readFile("buddy-screenshot.png");
const text = await tesseract.recognize(img);
console.log("Result:", text);
}
main();
It displays me an error :
node:events:371
throw er; // Unhandled 'error' event
^
Error: write EOF
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:98:16)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4095,
code: 'EOF',
syscall: 'write'
}
Do you know what happens and how make it works?
Upvotes: 1
Views: 221
Reputation: 46
Make sure you've installed Tesseract Engine as per documentation states in prerequisites.
Installation notes depending on your operating system can be found here: https://github.com/tesseract-ocr/tessdoc/blob/main/Installation.md
Lastly, check following command tesseract --version
in your terminal. If not recognized, you might need to add the PATH to your system's environment variables.
Upvotes: 1