Node.JS: how to fix error Tesseract couldn’t load any languages!


Error look like here:

Failed loading language 'deu'
Tesseract couldn't load any languages!

tesseract js error count not load any language

How to fix this error?

Method 1:

Tesseract.create({ langPath: "http://tessdata.projectnaptha.com/3.02/" }).recognize("/pathimg.png", {
    lang: 'deu' 
})

Method 2:
Step 1: Use local file train data
1.1a:
You can manually download file traindata at https://github.com/naptha/tessdata/tree/gh-pages/3.02 then untar. E.g. with english train data

https://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/eng.traineddata.gz
http://tessdata.projectnaptha.com/3.02/eng.traineddata.gz
https://raw.githubusercontent.com/naptha/tessdata/gh-pages/3.02/eng.traineddata.gz

1.1b: you can install package e.g. tesseract-langpack-deu

1.1c: download from here: https://github.com/tesseract-ocr/tessdata/tree/3.04.00

Step 2:
Consider that you use this directory /usr/share/tesseract/tessdata

Run Node.JS in this directory.

cd /usr/share/tesseract/tessdata
node /path/your/script/index.js

or you can use this method:

process.chdir('/usr/share/tesseract/tessdata');

Leave a Reply