I am trying to use the tesseract.js package in a node app. I am starting with a basic example from the documentation:
Tesseract = require("tesseract.js");
Tesseract.recognize(
'https://tesseract.projectnaptha.com/img/eng_bw.png',
'eng',
{ logger: m => console.log(m) }
).then(({ data: { text } }) => {
console.log(text);
})
However, running this app (in Heroku) yields the following error:
/app/node_modules/tesseract.js/src/index.js:24
...Tesseract,
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:56:10)
I am trying to resolve this error. There is a "..." in this index.js file in the package code - any ideas why this would be causing a problem? Not sure if I should submit an "issue" about it.
Duh, the problem seems to have been that my Heroku app was using a very outdated version of node, which I found by running
heroku run bash
node -v
I have updated it and everything works fine.