justadudewhohacks / opencv4nodejs

Nodejs bindings to OpenCV 3 and OpenCV 4
MIT License
4.97k stars 827 forks source link

SOLVED macOS Installation issues. #852

Open EdoTrotta opened 2 years ago

EdoTrotta commented 2 years ago

ERROR:

Error: Cannot find module '/Users/yourName/Desktop/project2/node_modules/opencv4nodejs/build/Release/opencv4nodejs'

Follow these steps and you should be able to install and work with this library. I've spent several hours trying to solve the issue and I think I've found something that works:

  1. Install OpenCV:
  1. Inside your repository:

This process should actually trigger the build in opencv4nodejs and now the module can be used without issues.

babA409866 commented 2 years ago

i still cannot solve the problem with so many build error

fendiflexin commented 2 years ago

I have the same issue on windows

EdoTrotta commented 2 years ago

I have the same issue on windows

This is supposed to fix macOS

UrielCh commented 2 years ago

Hi, Great news for those people that do not want to build their OpenCV: I published @u4/opencv4nodejs V 6.2.4 today,

This version autodetects the common setup path for Brew on Mac, Chocolatey on Windows, and Apt on Linux.

just define environment variable: OPENCV4NODEJS_DISABLE_AUTOBUILD=1

And your prebuild OpenCV will be used.

You may need to call: npx build-opencv rebuild or npx build-opencv --nobuild rebuild (if you do not define OPENCV4NODEJS_DISABLE_AUTOBUILD variable)

dids-reyes commented 4 months ago

tried it but i'm still getting this error

after npm install opencv4nodejs

throw new Error('library dir does not exist: ' + libDir)
Qwqw127 commented 2 months ago

Hi, Great news for those people that do not want to build their OpenCV: I published @u4/opencv4nodejs V 6.2.4 today,

This version autodetects the common setup path for Brew on Mac, Chocolatey on Windows, and Apt on Linux.

  • Windows:

choco install opencv

  • Mac:

brew install opencv

  • debian:

apt -y install libopencv-contrib-dev libopencv-dev

just define environment variable: OPENCV4NODEJS_DISABLE_AUTOBUILD=1

And your prebuild OpenCV will be used.

You may need to call: npx build-opencv rebuild or npx build-opencv --nobuild rebuild (if you do not define OPENCV4NODEJS_DISABLE_AUTOBUILD variable)

image