Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jbond1
Novice
1,188 Views

Failing to install opencv from package.json using npm install

Is there a solution to this?

So we get this following error when run the following command

$ npm install opencv 

-

 

> opencv@3.2.0 install /Applications/MAMP/htdocs/opencvTest/node_modules/opencv

 

> node-pre-gyp install --fallback-to-build

 

 

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 = 0, int SA...

 

^~~~~~~~~~~~

 

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 = 0, int SA...

 

~~~~~~~~~~^

 

../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:98:17)

 

gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)

 

gyp ERR! System Darwin 14.0.0

 

gyp ERR! command "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.2.0" "--major=3" "--minor=2" "--runtime=node" "--node_abi=node-v11" "--platform=darwin" "--target_platform=darwin" "--arch=x64" "--target_arch=x64" "--module_main=./lib/opencv" "--host=https://node-opencv.s3.amazonaws.com/ https://node-opencv.s3.amazonaws.com/" "--module_path=/Applications/MAMP/htdocs/opencvTest/node_modules/opencv/build/opencv/v3.2.0/Release/node-v11-darwin-x64" "--module=/Applications/MAMP/htdocs/opencvTest/node_modules/opencv/build/opencv/v3.2.0/Release/node-v11-darwin-x64/opencv.node" "--remote_path=./opencv/v3.2.0/Release/" "--package_name=node-v11-darwin-x64.tar.gz" "--staged_tarball=build/stage/opencv/v3.2.0/Release/node-v11-darwin-x64.tar.gz" "--hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/ https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/" "--hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/node-v11-darwin-x64.tar.gz https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/node-v11-darwin-x64.tar.gz"

 

gyp ERR! cwd /Applications/MAMP/htdocs/opencvTest/node_modules/opencv

 

gyp ERR! node -v v0.10.36

 

gyp ERR! node-gyp -v v1.0.3

 

gyp ERR! not ok

 

node-pre-gyp ERR! build error

 

node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp rebuild --name=opencv --configuration=Release --module_name=opencv --version=3.2.0 --major=3 --minor=2 --runtime=node --node_abi=node-v11 --platform=darwin --target_platform=darwin --arch=x64 --target_arch=x64 --module_main=./lib/opencv --host=https://node-opencv.s3.amazonaws.com/ https://node-opencv.s3.amazonaws.com/ --module_path=/Applications/MAMP/htdocs/opencvTest/node_modules/opencv/build/opencv/v3.2.0/Release/node-v11-darwin-x64 --module=/Applications/MAMP/htdocs/opencvTest/node_modules/opencv/build/opencv/v3.2.0/Release/node-v11-darwin-x64/opencv.node --remote_path=./opencv/v3.2.0/Release/ --package_name=node-v11-darwin-x64.tar.gz --staged_tarball=build/stage/opencv/v3.2.0/Release/node-v11-darwin-x64.tar.gz --hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/ https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/ --hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/node-v11-darwin-x64.tar.gz https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/node-v11-darwin-x64.tar.gz' (1)

 

node-pre-gyp ERR! stack at ChildProcess. (/Applications/MAMP/htdocs/opencvTest/node_modules/opencv/node_modules/node-pre-gyp/lib/util/compile.js:76:29)

 

node-pre-gyp ERR! stack at ChildProcess.emit (events.js:98:17)

 

node-pre-gyp ERR! stack at maybeClose (child_process.js:766:16)

 

node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_pr...
3 Replies
Sergio_A_Intel
Employee
119 Views

Hi,

What steps have you done prior to typing npm install opencv? Have you followed the steps from this guide https://www.npmjs.com/package/opencv opencv ? What versions do you have of opencv, python, node and npm?

Sergio

Carlos_M_Intel
Employee
119 Views

Hi teambond1,

Do you have updates on this?

Could you post the outcome of running the following commands?

python --version

node --version

npm --version

Regards,

Charlie

jbond1
Novice
119 Views

We installed the http://repo.opkg.net/edison/repo/ package repo for Edison. in the base-feed.conf file and ran opkg. that's all! Now we got openCV to work thank God!

Our problem was trying to run a program that requires OpenCV development environment to be installed when we didn't have it.

we installed the openCV on the Intel Edison using this command opkg install opencv-dev and that was it. Our program worked after that.

Reply