Running in Windows gives error but running in Ubuntu with same script is fine
See original GitHub issueHello,
Here is the working script which works on Linux.
const tesseract = require('node-tesseract-ocr');
const config = {
lang: 'eng',
oem: 1,
psm: 3
}
tesseract
.recognize('image.jpg', config)
.then(text => {
console.log('Result:', text)
})
.catch(err => {
console.log('error:', err)
})
Here is the non-working script I used on Windows (same package.json).
const tesseract = require('node-tesseract-ocr');
const config = {
lang: 'eng',
oem: 1,
psm: 3
}
tesseract
.recognize('image.jpg', config)
.then(text => {
console.log('Result:', text)
})
.catch(err => {
console.log('error:', err)
})
Identical.
Here is the error message:
error: { Error: Command failed: tesseract image.jpg stdout -l eng --oem 1 --psm 3
'tesseract' is not recognized as an internal or external command,
operable program or batch file.
at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:198:13)
at maybeClose (internal/child_process.js:982:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
killed: false,
code: 1,
signal: null,
cmd: 'tesseract image.jpg stdout -l eng --oem 1 --psm 3' }
What is going on? How can I solve this error?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
If/Else in shell script throws errors in Ubuntu for Windows
There are two problems here. First, while you have a shebang line calling bash, you are executing the script as sh script.sh ....
Read more >Failure in executing shell script producing output on Ubuntu ...
You appear to have mangled text in nonexistentssion.sh: and No such file or directorytput.txt which suggests you might have Windows line-endings ...
Read more >Troubleshooting Windows Subsystem for Linux | Microsoft Learn
Provides detailed information about common errors and issues people run into while running Linux on the Windows Subsystem for Linux.
Read more >Unable to run shell script in windows 10 with Bash on Ubuntu
1 Answer 1 · This script is compiled in such a way that matters where it is running. · Another possible problem -...
Read more >Ubuntu Server Documentation
The Ubuntu Server Edition and the Ubuntu Desktop Edition use the same apt ... When running on serial, the installer starts in a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @doverradio , I had the same problem. I assume you’re using VS-Code to code and to run it (with the VS-Code Terminal). In these case, the problem is something with the Powershell, that doesn’t recognize the command “tesseract”.
To solve this problem, try to run your application using CMD. It works fine for me.
Didn’t solve it for me. I tried installing the pacakge globally as well but that didn’t help