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

opencv4nodejs install error on macos intel - binding.gyp not found #13

Closed
QingLeiLi opened this issue Feb 26, 2022 · 12 comments
Closed

Comments

@QingLeiLi
Copy link

QingLeiLi commented Feb 26, 2022

opencv4nodejs install error on macos intel.
Is there something missing?

Error Message

> @u4/opencv4nodejs@6.1.1 install /opencv-test/node_modules/@u4/opencv4nodejs
> node-gyp rebuild

gyp: binding.gyp not found (cwd: /opencv-test/node_modules/@u4/opencv4nodejs) while trying to load binding.gyp

OpenCV version : 4.5.4_4

With OpenCV-contrib? (extra modules): no

OS: MacOSX Intel

@rih28
Copy link

rih28 commented Feb 26, 2022

I am also having this issue.

@rih28
Copy link

rih28 commented Feb 26, 2022

Seems that node-gyp is trying to rebuild on install. I had this working around exactly 20 days ago so I am guessing that it may be to do with the last commit. My method to get it working on an intel Mac was quite convoluted at that time:

npm install --save @u4/opencv4nodejs
Add the script lines to the package.json
npm install -g node-gyp
inside the @u4/opencv4nodejs directory in node_modules rename _binding.gyp to binding.gyp
Go to root folder
npm run do-install

However, I can't get past the initial npm install now, and none of the switches seem to disable the node-gyp rebuild command (except --dry-run, which is just a series of logs to the console).

@UrielCh
Copy link
Owner

UrielCh commented Feb 26, 2022

binding.gyp is hidden by default as _binding.gyp the build script copy it as binding.gyp during the custom build process.

@QingLeiLi
Copy link
Author

@UrielCh hi, could u install the package successfully on Nodejs v12.20.1?
and what does the custom build mean?
I just install the package with npm install @u4/opencv4nodejs, but it does not work.

@UrielCh
Copy link
Owner

UrielCh commented Feb 27, 2022

See opencv4nodejs/install/compileLib.ts

This script properly configure environment before calling node-gyp rebuild.

see:

  "bin": {
    "build-opencv": "bin/install.js"
  },

in package.json

Hiding binding.gyp is necessaire with modern nodeJS version, that a bug or a feature, I should open an issue in nodeJS.

Update, that a feature:

from: https://docs.npmjs.com/cli/v8/configuring-npm/package-json

If there is a binding.gyp file in the root of your package and you have not defined an install or preinstall script, npm will default the install command to compile using node-gyp.

@UrielCh
Copy link
Owner

UrielCh commented Feb 27, 2022

Version 6.1.2 is out

@QingLeiLi
Copy link
Author

QingLeiLi commented Feb 27, 2022

@UrielCh Tanks for the replay and work.
I try to install the @u4/opencv4nodejs@6.1.2, but install script is broken.

> echo Use 'build-opencv rebuild' of (node bin/install.js rebuild) script to start node-gyp, use --help to check all options.

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `echo Use 'build-opencv rebuild' of (node bin/install.js rebuild) script to start node-gyp, use --help to check all options.'
Maybe the `()` need `\`, like
echo Use 'build-opencv rebuild' of \(node bin/install.js rebuild\) script to start node-gyp, use --help to check all options.

@QingLeiLi
Copy link
Author

QingLeiLi commented Feb 27, 2022

Send a PR. Feel free to edit.

@UrielCh
Copy link
Owner

UrielCh commented Feb 28, 2022

noooo, I need to made a new release :(
I should enable the test pipeline.

@UrielCh
Copy link
Owner

UrielCh commented Feb 28, 2022

Is the original issue still exists ?

My Intel based MacOS is in a cupboard...

@QingLeiLi
Copy link
Author

I will try again tonight, sorry for the delay replay.

@QingLeiLi
Copy link
Author

QingLeiLi commented Mar 4, 2022

@UrielCh The original issue has been fixed, the installation can be completed normally, thanks.
The next problem is that the opencv compilation fails.
It seems that this library cannot use the opencv installed by brew. I will open a new issue after trying it.

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

3 participants