-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read properties of undefined (reading 'TessBaseAPI') #752
Comments
Please specify the version of Tesseract.js you are using in any bug reports, along with any other information that would be necessary to reproduce the behavior described. I was unable to replicate this issue. I saved the following code into a file in the Node examples folder, and then ran the file out of that folder, and it ran as expected.
|
The same is happening with me. Node.js v18.15.0 Code: const { createWorker } = require("tesseract.js");
(async () => {
const worker = await createWorker();
await worker.loadLanguage("eng");
await worker.initialize("eng");
const {
data: { text },
} = await worker.recognize("https://tesseract.projectnaptha.com/img/eng_bw.png");
console.log(text);
await worker.terminate();
})(); Error message:
package.json {
"dependencies": {
"tesseract.js": "^2.1.0"
}
}
|
@jonas-duarte Version 2.1.0 is an old/unsupported version that does not run on Node.js 18. The latest version at the time of this writing is v4.0.6. Please upgrade to the latest version of Tesseract.js (although anything v3 or higher should work). I am closing this issue as I do not see any indication that this happens with supported versions of Tesseract.js. |
It worked, thank you. When I googled it, I was redirected to the v2.
|
const worker = await createWorker();
const rectangle = { left: 0, top: 0, width: 500, height: 250 };
(async () => {
await worker.loadLanguage('eng');
await worker.initialize('eng');
const {
data: { text }
} = await worker.recognize(
'https://tesseract.projectnaptha.com/img/eng_bw.png',
{ rectangle }
);
console.log(text);
await worker.terminate();
})();
I write this and return this
The text was updated successfully, but these errors were encountered: