Skip to content
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

Why my code didn't work... #48

Closed
smackgg opened this issue Oct 17, 2016 · 9 comments
Closed

Why my code didn't work... #48

smackgg opened this issue Oct 17, 2016 · 9 comments

Comments

@smackgg
Copy link

smackgg commented Oct 17, 2016

My code:

const path = require('path');
const Tesseract = require('tesseract.js');
const myImage = path.resolve(__dirname, 'out.png');
Tesseract.recognize(myImage)
    .progress(message => console.log(message))
    .catch(err => console.error(err))
    .then(result => console.log(result))
    .finally(resultOrError => console.log(resultOrError))

Issues:

/Users/xuyan/Documents/my/node/login/node_modules/tesseract.js/src/index.js:15
class TesseractWorker {
^^^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:404:25)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/xuyan/Documents/my/node/login/testPng.js:3:19)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
@bijection
Copy link
Member

what version of node are you using?

@smackgg
Copy link
Author

smackgg commented Oct 17, 2016

node -v
v5.1.0

@rowasc
Copy link
Contributor

rowasc commented Oct 17, 2016

Hi @winnerweb
From the README.md file:
Note: Tesseract.js currently requires node v6.8.0 or greater.
so that's probably it.

@bijection
Copy link
Member

Thanks @rowasc!
You're right, @winnerweb you'll need to update node to use Tesseract.js.

@smackgg
Copy link
Author

smackgg commented Oct 17, 2016

@bijection @rowasc Thanks, I will try it...

@tetreault
Copy link

This is what I get for not fully reading the README 🤦‍♂️

@fjlogrono
Copy link

I'm getting the same error, but when I put a cordova project.
In angular 5 in desktop it works correctly (With node 9)

@jeromewu
Copy link
Member

jeromewu commented Mar 1, 2018

When you are getting the same error, which node version were you using?

@fjlogrono
Copy link

Excuse me, I'm stupid.
I am using local, node version 9.0

But of course, if I add to cordoba the generated in angular CLI, there is no node.

So what I've done is use the CDN.
Thanks and sorry for the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants