zapolnoch / node-tesseract-ocr

A Node.js wrapper for the Tesseract OCR API
MIT License
304 stars 38 forks source link

Error: Unhandled 'error' event write EOF ... Emitted 'error' event on Socket instance at: #45

Open vivien7512 opened 1 year ago

vivien7512 commented 1 year ago

On Windows 10 and windows 11:

the basic example dos not works well

npm install node-tesseract-ocr npm install fs.promises

const tesseract = require("node-tesseract-ocr");
const fs = require("fs/promises");

async function main() {
  const img = await fs.readFile("image.png");
  const text = await tesseract.recognize(img);

  console.log("Result:", text);
}

main();

The basic example generate an error :

node index.js
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: write EOF
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4095,
  code: 'EOF',
  syscall: 'write'
}

Node.js v18.12.1
joshkay commented 1 year ago

Haivng the same issue, any luck fixing it?

Lambdac0re commented 1 year ago

Install tesseract on your machine first. Check installation with tesseract -v

MANTENN commented 5 months ago

I had to restart my IDE and manually add it to the PATH variable.