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

Cannot find module opencv4nodejs/build/Release/opencv4nodejs #124

Open
nashxena opened this issue Jan 13, 2024 · 6 comments
Open

Cannot find module opencv4nodejs/build/Release/opencv4nodejs #124

nashxena opened this issue Jan 13, 2024 · 6 comments

Comments

@nashxena
Copy link

nashxena commented Jan 13, 2024

Please help how to run on mac M1 , Node 16

opencv installed with:
brew install opencv@4
brew link --force opencv@4

export OPENCV_INCLUDE_DIR=/opt/homebrew/Cellar/opencv/4.8.1_5/include/opencv4
export OPENCV_LIB_DIR=/opt/homebrew/Cellar/opencv/4.8.1_5/lib
export OPENCV4NODEJS_DISABLE_AUTOBUILD=1
export OPENCV_BIN_DIR=/opt/homebrew/Cellar/opencv/4.8.1_5/bin

npm install @u4/opencv4nodejs : npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
added 117 packages, and audited 148 packages in 14s

used in code testopencv.js:
const cv = require('opencv4nodejs');

const mat = new cv.Mat(100, 100, cv.CV_8UC3, [0, 0, 0]);
console.log('OpenCV Matrix:', mat);

node testopencv.js causes error:
Cannot find module opencv4nodejs/build/Release/opencv4nodejs
...
at Object. (/node_modules/opencv4nodejs/lib/cv.js:40:8)
...

@deflexable
Copy link

also getting this issue, did you find a solution?

@1009058470
Copy link

it maybe u require error
it should be const cv = require('@u4/opencv4nodejs');

@nashxena
Copy link
Author

Same error even after const cv = require('@u4/opencv4nodejs');

@1009058470
Copy link

1009058470 commented Jan 15, 2024

I give up this
maybe u should have a look at opencv.js in u code and then
using const cv = require('where is opencv.js') and use it as tutorial

do not forget to ignore opencv.js for u tools for build

@ZAIDMULTANI07
Copy link

Hi there, I am experiencing the same issue.

@PavelPolyakov
Copy link

yeah, have the same.

It's possible to run it with OPENCV4NODES_DEBUG_REQUIRE=1 for more debug output. It starts to fail here: https://github.com/UrielCh/opencv4nodejs/blob/master/lib/cvloader.js#L60 , because we do not have path env variable, but have PATH.

Even when I change process.env.path to process.env.PATH, then it still tries to require opencv4nodejs.node. IDK why it shall be there (or somewhere, since we try to use opencv from brew).

🤷

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

5 participants