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

ERROR: failed to run: pkg-config when running npm install git+https://[email protected]/danschultzer/receipt-scanner.git #62

Open
Anima-t3d opened this issue Mar 30, 2019 · 7 comments

Comments

@Anima-t3d
Copy link

When I run npm install git+https://[email protected]/danschultzer/receipt-scanner.git I get the following error:

> node-gyp rebuild

/Users/brechtmissotten/Projects/personal/receipt-parser/node_modules/opencv/utils/find-opencv.js:28
              throw new Error("ERROR: failed to run: pkg-config" + opencv + " " + flag + " - Is OpenCV installed?");
              ^

Error: ERROR: failed to run: pkg-config "opencv >= 2.3.1" --cflags - Is OpenCV installed?
    at /Users/brechtmissotten/Projects/personal/receipt-parser/node_modules/opencv/utils/find-opencv.js:28:21
    at ChildProcess.exithandler (child_process.js:304:5)
    at ChildProcess.emit (events.js:193:13)
    at maybeClose (internal/child_process.js:1001:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
gyp: Call to 'node utils/find-opencv.js --cflags' returned exit status 1 while in binding.gyp. while trying to load binding.gyp

I tried re-installing and also https://stackoverflow.com/a/46743865/3163075 to no avail.

Might be related to peterbraden/node-opencv#325

@Schultzer
Copy link
Collaborator

Schultzer commented Mar 30, 2019

What version of OpenCV do you have installed?

@Anima-t3d
Copy link
Author

How can I check? I think I saw something like 4.0.1 when I was running the install.

@Schultzer
Copy link
Collaborator

The issue is in node-opencv

https://github.com/peterbraden/node-opencv/blob/db093cb2ec422e507a61e79dd490126060a7e7d0/utils/find-opencv.js#L18

var opencv = process.env.PKG_CONFIG_OPENCV3 === "1" ? "opencv3" : ' "opencv >= 2.3.1"';

The reason it errors is that you are using opencv 4. node-opencv has not been updated to opencv 4.
You could try uninstall opencv 4 and install opencv 3 instead.

@Anima-t3d
Copy link
Author

Anima-t3d commented Apr 1, 2019

I ran brew uninstall opencv and brew install opencv@3, got a lot of warnings but it went through.

When I try to run the receipt-scanner I get the following issue:

{ Error: Command failed: tesseract /var/folders/s1/2w_5_wds32xd4t4pf5kddtgm0000gn/T/tmp-1089275wv7gp4xOyq.png /var/folders/s1/2w_5_wds32xd4t4pf5kddtgm0000gn/T/node-tesseract-26fc5357-ccbb-4907-bf33-4784bdeb264d -l eng -psm 3
Error, unknown command line argument '-psm'

    at ChildProcess.exithandler (child_process.js:297:12)
    at ChildProcess.emit (events.js:193:13)
    at maybeClose (internal/child_process.js:1001:16)
    at Socket.stream.socket.on (internal/child_process.js:405:11)
    at Socket.emit (events.js:193:13)
    at Pipe._handle.close (net.js:614:12)
  killed: false,
  code: 1,
  signal: null,
  cmd:
   'tesseract /var/folders/s1/2w_5_wds32xd4t4pf5kddtgm0000gn/T/tmp-1089275wv7gp4xOyq.png /var/folders/s1/2w_5_wds32xd4t4pf5kddtgm0000gn/T/node-tesseract-26fc5357-ccbb-4907-bf33-4784bdeb264d -l eng -psm 3' }

Seems like it's no longer supported in tesseract 4 and now uses --psm

I tried brew uninstall tesseract and brew install tesseract@3 but couldn't find such version to install.

@Schultzer
Copy link
Collaborator

Yeah looking at https://github.com/desmondmorris/node-tesseract it doesn't support tesseract 4 yet.

@Anima-t3d
Copy link
Author

@Schultzer Seems like node-tesseract is no longer maintained, there are a few pull requests addressing this issue already: desmondmorris/node-tesseract#62

@Anima-t3d
Copy link
Author

I applied the update as seen in desmondmorris/node-tesseract#62 in my local node_module, however I got the following error:

{ Error: Command failed: tesseract /var/folders/s1/2w_5_wds32xd4t4pf5kddtgm0000gn/T/tmp-13564744nKwcbZlrp.png /var/folders/s1/2w_5_wds32xd4t4pf5kddtgm0000gn/T/node-tesseract-9f229b6e-506e-4271-8414-c4062099c744 -l eng --psm 3 --oem undefined
Failed loading language 'eng'
Tesseract couldn't load any languages!
Could not initialize tesseract.

    at ChildProcess.exithandler (child_process.js:297:12)
    at ChildProcess.emit (events.js:193:13)
    at maybeClose (internal/child_process.js:1001:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
  killed: false,
  code: 1,
  signal: null,
  cmd:
   'tesseract /var/folders/s1/2w_5_wds32xd4t4pf5kddtgm0000gn/T/tmp-13564744nKwcbZlrp.png /var/folders/s1/2w_5_wds32xd4t4pf5kddtgm0000gn/T/node-tesseract-9f229b6e-506e-4271-8414-c4062099c744 -l eng --psm 3 --oem undefined' }

Seems related to #61

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

2 participants