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 use opencv4nodejs (prebuilt with brew) #887

Open
OlehPetrykUA opened this issue Jan 21, 2025 · 0 comments
Open

Cannot use opencv4nodejs (prebuilt with brew) #887

OlehPetrykUA opened this issue Jan 21, 2025 · 0 comments

Comments

@OlehPetrykUA
Copy link

OlehPetrykUA commented Jan 21, 2025

I have installed opencv using brew and followed all the inscructions on how to disabled auto build and so on

I have such config in package.json

  "opencv4nodejs": {
    "disableAutoBuild": 1,
    "opencvIncludeDir": "/opt/homebrew/Cellar/opencv/4.11.0/include",
    "opencvLibDir": "/opt/homebrew/Cellar/opencv/4.11.0/lib",
    "opencvBinDir": "/opt/homebrew/Cellar/opencv/4.11.0/bin"
  }

I also have updated my .zshrc file with

export OPENCV_INCLUDE_DIR=/opt/homebrew/Cellar/opencv/4.11.0/include
export OPENCV_BIN_DIR=/opt/homebrew/Cellar/opencv/4.11.0/bin
export OPENCV_LIB_DIR=/opt/homebrew/Cellar/opencv/4.11.0/lib
export OPENCV4NODEJS_DISABLE_AUTOBUILD=1

The installation goes correctly but when i try to run simple script

const cv = require('opencv4nodejs');

console.log('OpenCV version:', cv.version);

I get this

Error: Cannot find module '/Users/opetryk/Projects/my-mac-bot/node_modules/opencv4nodejs/build/Release/opencv4nodejs'
Require stack:
- /Users/opetryk/Projects/my-mac-bot/node_modules/opencv4nodejs/lib/cv.js
- /Users/opetryk/Projects/my-mac-bot/node_modules/opencv4nodejs/lib/opencv4nodejs.js
- /Users/opetryk/Projects/my-mac-bot/test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/Users/opetryk/Projects/my-mac-bot/node_modules/opencv4nodejs/lib/cv.js:40:8)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/opetryk/Projects/my-mac-bot/node_modules/opencv4nodejs/lib/cv.js',
    '/Users/opetryk/Projects/my-mac-bot/node_modules/opencv4nodejs/lib/opencv4nodejs.js',
    '/Users/opetryk/Projects/my-mac-bot/test.js'
  ]
}

Node.js v18.20.4
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

1 participant