zapolnoch / node-tesseract-ocr

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

'tesseract' is not recognized as an internal or external command, operable program or batch file. #37

Open RitvikSardana opened 2 years ago

RitvikSardana commented 2 years ago

I have added the path to environment variables , still I am getting this error while using node-tesseract-ocr library in my Node JS code.

tesseract .recognize(imgPath, config) .then((text) => { console.log("Result:", text) var words = text.split(" "); console.log(words); var code = words[0].substring(0, 6); console.log("the verification code is: " + code); return code; }) .catch((error) => { console.log(error.message) })

image

Can someone help me?

ToWelie89 commented 2 years ago

I get the same

ToWelie89 commented 2 years ago

I have added the path to environment variables , still I am getting this error while using node-tesseract-ocr library in my Node JS code.

tesseract .recognize(imgPath, config) .then((text) => { console.log("Result:", text) var words = text.split(" "); console.log(words); var code = words[0].substring(0, 6); console.log("the verification code is: " + code); return code; }) .catch((error) => { console.log(error.message) })

image

Can someone help me?

I solved it. You must first install Tesseract, if you are using Windows you can go here: https://github.com/UB-Mannheim/tesseract/wiki

Then you must add the tesseract install folder (for me it was C:\Program Files\Tesseract-OCR) to you PATH variable. Here's how: https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/