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

SOLVED macOS Installation issues. #852

Open
EdoTrotta opened this issue Jun 24, 2022 · 4 comments
Open

SOLVED macOS Installation issues. #852

EdoTrotta opened this issue Jun 24, 2022 · 4 comments

Comments

@EdoTrotta
Copy link

EdoTrotta commented Jun 24, 2022

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:
  • brew install opencv@4
  • brew link --force opencv@4
  1. Inside your repository:
  • Install your node modules but avoid installing opencv4nodejs via npm i.
  • Use a specific node version with nvm, node v14.18.1 or v14.17.0 will do.
  • Run export CXXFLAGS="-std=c++14 -Wno-c++11-narrowing" in the root of your project.
  • Run npm install opencv4nodejs

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

@babA409866
Copy link

i still cannot solve the problem with so many build error

@fendiflexin
Copy link

I have the same issue on windows

@EdoTrotta
Copy link
Author

I have the same issue on windows

This is supposed to fix macOS

@UrielCh
Copy link
Contributor

UrielCh commented Aug 30, 2022

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)

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

4 participants