opencv does not install on mac os yosemite
I am getting errors when I am trying to install opencv using the following command npm install opencv
The error is as follows
[email protected] install /Users/aniketshirsat/node_ARDrone/node_modules/opencv node-pre-gyp install --fallback-to-build
child_process: customFds option is deprecated, use stdio instead.
CXX(target) Release/obj.target/opencv/src/init.o
In file included from ../src/init.cc:5:
../src/CascadeClassifierWrap.h:5:3: error: no type named 'CascadeClassifier' in
namespace 'cv'; did you mean 'CascadeClassifierWrap'?
cv::CascadeClassifier cc;
^~~~~~~~~~~~~~~~~~~~~
CascadeClassifierWrap
../src/CascadeClassifierWrap.h:3:7: note: 'CascadeClassifierWrap' declared here
class CascadeClassifierWrap: public node::ObjectWrap {
^
In file included from ../src/init.cc:6:
../src/VideoCaptureWrap.h:5:7: error: no type named 'VideoCapture' in namespace
'cv'; did you mean 'VideoCaptureWrap'?
cv::VideoCapture cap;
^~~~~~~~~~~~~~~~
VideoCaptureWrap
../src/VideoCaptureWrap.h:3:7: note: 'VideoCaptureWrap' declared here
class VideoCaptureWrap: public node::ObjectWrap {
^
In file included from ../src/init.cc:15:
../src/Stereo.h:8:5: error: no type named 'StereoBM' in namespace 'cv'; did you
mean simply 'StereoBM'?
cv::StereoBM stereo;
^~~~~~~~~~~~
StereoBM
../src/Stereo.h:6:7: note: 'StereoBM' declared here
class StereoBM: public node::ObjectWrap {
^
../src/Stereo.h:14:27: error: no member named 'StereoBM' in namespace 'cv'; did
you mean simply 'StereoBM'?
StereoBM(int preset = cv::StereoBM::BASIC_PRESET, int ndisparities ...
^~~~~~~~~~~~
StereoBM
../src/Stereo.h:6:7: note: 'StereoBM' declared here
class StereoBM: public node::ObjectWrap {
^
../src/Stereo.h:14:41: error: no member named 'BASIC_PRESET' in 'StereoBM'
StereoBM(int preset = cv::StereoBM::BASIC_PRESET, int ndisparities ...
~~~~~~~~~~^
../src/Stereo.h:21:5: error: no type named 'StereoSGBM' in namespace 'cv'; did
you mean simply 'StereoSGBM'?
cv::StereoSGBM stereo;
^~~~~~~~~~~~~~
StereoSGBM
../src/Stereo.h:19:7: note: 'StereoSGBM' declared here
class StereoSGBM: public node::ObjectWrap {
^
6 errors generated.
make: *** [Release/obj.target/opencv/src/init.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=opencv" "--configuration=Release" "--module_name=opencv" "--version=3.1.0" "--major=3" "--minor=1" "--runtime=node" "--node_abi=node-v14" "--platform=darwin" "--target_platform=darwin" "--arch=x64" "--target_arch=x64" "--module_main=./lib/opencv" "--host=https://node-opencv.s3.amazonaws.com/" "--module_path=/Users/aniketshirsat/node_ARDrone/node_modules/opencv/build/opencv/v3.1.0/Release/node-v14-darwin-x64" "--module=/Users/aniketshirsat/node_ARDrone/node_modules/opencv/build/opencv/v3.1.0/Release/node-v14-darwin-x64/opencv.node" "--remote_path=./opencv/v3.1.0/Release/" "--package_name=node-v14-darwin-x64.tar.gz" "--staged_tarball=build/stage/opencv/v3.1.0/Release/node-v14-darwin-x64.tar.gz" "--hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.1.0/Release/" "--hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.1.0/Release/node-v14-darwin-x64.tar.gz"
gyp ERR! cwd /Users/aniketshirsat/node_ARDrone/node_modules/opencv
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js rebuild --name=opencv --configuration=Release --module_name=opencv --version=3.1.0 --major=3 --minor=1 --runtime=node --node_abi=node-v14 --platform=darwin --target_platform=darwin --arch=x64 --target_arch=x64 --module_main=./lib/opencv --host=https://node-opencv.s3.amazonaws.com/ --module_path=/Users/aniketshirsat/node_ARDrone/node_modules/opencv/build/opencv/v3.1.0/Release/node-v14-darwin-x64 --module=/Users/aniketshirsat/node_ARDrone/node_modules/opencv/build/opencv/v3.1.0/Release/node-v14-darwin-x64/opencv.node --remote_path=./opencv/v3.1.0/Release/ --package_name=node-v14-darwin-x64.tar.gz --staged_tarball=build/stage/opencv/v3.1.0/Release/node-v14-darwin-x64.tar.gz --hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.1.0/Release/ --hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.1.0/Release/node-v14-darwin-x64.tar.gz' (1)
node-pre-gyp ERR! stack at ChildProcess.
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the opencv package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls opencv
npm ERR! There is likely additional logging output above.
Can anyone suggest a fix for this.
I'm getting this same error with almost all the same stats (Darwin 14.3 instead of 14.4, npm 1.3.24 instead of 2.11.3)
I installed opencv with homebrew
were you able to use it with node-ardrone?
No, haven't tried. I don't have an AR drone. Anything of use there that you saw to get this package working? I'm still stuck after also trying to build opencv 2.8 - even though it seemed to get further along in the build before blowing up with the lower version number.
Maybe I'll try all the way back to 2.3 and see if it's just that the bindings are expecting a very specific version of opencv
I backed my node version down to v.10.36 and I'm now getting a partial install. Partial command line output is:
> [email protected] install /Users/alan/github/vision/node_modules/opencv
> node-pre-gyp install --fallback-to-build
CXX(target) Release/obj.target/opencv/src/init.o
CXX(target) Release/obj.target/opencv/src/Matrix.o
CXX(target) Release/obj.target/opencv/src/OpenCV.o
CXX(target) Release/obj.target/opencv/src/CascadeClassifierWrap.o
CXX(target) Release/obj.target/opencv/src/Contours.o
CXX(target) Release/obj.target/opencv/src/Point.o
CXX(target) Release/obj.target/opencv/src/VideoCaptureWrap.o
CXX(target) Release/obj.target/opencv/src/CamShift.o
CXX(target) Release/obj.target/opencv/src/HighGUI.o
CXX(target) Release/obj.target/opencv/src/FaceRecognizer.o
CXX(target) Release/obj.target/opencv/src/Features2d.o
CXX(target) Release/obj.target/opencv/src/BackgroundSubtractor.o
CXX(target) Release/obj.target/opencv/src/Constants.o
CXX(target) Release/obj.target/opencv/src/Calib3D.o
CXX(target) Release/obj.target/opencv/src/ImgProc.o
CXX(target) Release/obj.target/opencv/src/Stereo.o
SOLINK_MODULE(target) Release/opencv.node
clang: error: no such file or directory: 'OpenCL'
clang: error: no such file or directory: 'AppKit'
clang: error: no such file or directory: 'QuartzCore'
clang: error: no such file or directory: 'QTKit'
clang: error: no such file or directory: 'Cocoa'
make: *** [Release/opencv.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/alan/.nvm/v0.10.36/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Darwin 14.4.0
Which means it looks like it's choking on finding some native os-x libraries
If you just want to install opencv without the node package then you can simply download the package from opencv.org or using home-brew brew install opencv
On Mon, Aug 24, 2015 at 8:21 PM, Alan Languirand [email protected] wrote:
No, haven't tried. I don't have an AR drone. Anything of use there that you saw to get this package working? I'm still stuck after also trying to build opencv 2.8 - even though it seemed to get further along in the build before blowing up with the lower version number.
Maybe I'll try all the way back to 2.3 and see if it's just that the bindings are expecting a very specific version of opencv
— Reply to this email directly or view it on GitHub https://github.com/peterbraden/node-opencv/issues/281#issuecomment-134462861 .
OK. I just make the whole process from 0...
/Mac Instructions/
- Uninstall OpenCV 3.0
- Install "brew"
- In the terminal: brew install opencv
- Go to node_modules in your project folder.
- Download node_opencv_master
- Unzip and rename the folder to "opencv"
- Enter to "opencv" and make: npm install (some warnings on this step but don't worry)
- Now you can exit to the root project. And throw a normal "npm install" (just npm install, without opencv).
Voilà! Now compiles and the examples works.
@davduran's answer seems to be a good fix for this. Furthermore, doing brew install opencv3 works well for me in yosemite and sierra.