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
Tesseract.js fails on nodejs when trying to package it as standalone #882
Comments
In general, issues related to packaging are generally caused by:
If the above does not answer your question, we would need a reproducible example repo to troubleshoot further. |
I am not a professional coder so my code is pretty messy currently and I am working with non sharable stuff.
I also tried creating the worker with:
I tried requiring the "tesseract.min.js" (hence why it's in the screenshot) like I would in browser but I get hit by "TypeError: r.g.addEventListener is not a function" (kinda expected) since im not using it in browser context. In both cases when running with node it works (i did it to check syntax and that the paths were right) but after packaging it doesnt (Also note that I run my exe in the same location as when I run it using node and I tried both packaging or excluding the pathfolders when running pkg) Just to be sure i will add a screenshot of what I include in the external folders (maybe I misread from the faq at this link? |
Thank you very much! With your help and the post you tagged I was able to solve this. Leaving a verbose response if anyone else ever needs it My code and paths
I copied the whole folder from ./node-modules/tesseract.js/src to another directory and pointed the worker path there, also included the core files as in the Local Installation FAQ and a pre downloaded eng.traineddata. Picture to show code+ relative folder structure |
Tesseract.js version 5.0.4)
Describe the bug
When trying to package with pkg tesseract.js silently fails on createWorker even when including the two folders (tesseract.js and tesseract-core") separately.
can't even log any error with logger/errorHandler nor in a try/catch block
I would also like to add that it probably fails cause of this error "TypeError: r.g.addEventListener is not a function"
But it could also just be that I am messing trying to include the worker/tesseract and lang files separately.
If I serve from my packaged app a webpage with a tesseract script it will work, I just can't seem to use it as packaged.
Device Version:
The text was updated successfully, but these errors were encountered: