node-opencv icon indicating copy to clipboard operation
node-opencv copied to clipboard

installation problem

Open grugna opened this issue 11 years ago • 17 comments

Hello, i apologise for the disturbance, but i have spent one week trying to install opencv on node. I tryed with different version of node and different version of opencv, but when i prompted the command "npm install opencv" i always got the error above. Could you help me please because i need it to proceed with my thesis? I'm looking forward to hearing from you. Thank you!

Luca Graglia

ERROR:

labuser@labuser-VirtualBox:~$ npm install opencv

[email protected] install /home/labuser/node_modules/opencv node-pre-gyp install --fallback-to-build

make: Entering directory /home/labuser/node_modules/opencv/build' CXX(target) Release/obj.target/opencv/src/init.o In file included from ../src/init.cc:1:0: ../src/OpenCV.h:9:23: fatal error: opencv/cv.h: No such file or directory compilation terminated. make: *** [Release/obj.target/opencv/src/init.o] Error 1 make: Leaving directory/home/labuser/node_modules/opencv/build' 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:267:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12) gyp ERR! System Linux 3.2.0-29-generic-pae 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.0.0" "--major=3" "--runtime=node" "--node_abi=node-v11" "--platform=linux" "--target_platform=linux" "--arch=ia32" "--target_arch=ia32" "--module_main=./lib/opencv" "--host=https://node-opencv.s3.amazonaws.com/" "--module_path=/home/labuser/node_modules/opencv/build/opencv/v3.0.0/Release/node-v11-linux-ia32" "--module=/home/labuser/node_modules/opencv/build/opencv/v3.0.0/Release/node-v11-linux-ia32/opencv.node" "--remote_path=./opencv/v3.0.0/Release/" "--package_name=node-v11-linux-ia32.tar.gz" "--staged_tarball=build/stage/opencv/v3.0.0/Release/node-v11-linux-ia32.tar.gz" "--hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.0.0/Release/" "--hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.0.0/Release/node-v11-linux-ia32.tar.gz" gyp ERR! cwd /home/labuser/node_modules/opencv gyp ERR! node -v v0.10.31 gyp ERR! node-gyp -v v1.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.0.0 --major=3 --runtime=node --node_abi=node-v11 --platform=linux --target_platform=linux --arch=ia32 --target_arch=ia32 --module_main=./lib/opencv --host=https://node-opencv.s3.amazonaws.com/ --module_path=/home/labuser/node_modules/opencv/build/opencv/v3.0.0/Release/node-v11-linux-ia32 --module=/home/labuser/node_modules/opencv/build/opencv/v3.0.0/Release/node-v11-linux-ia32/opencv.node --remote_path=./opencv/v3.0.0/Release/ --package_name=node-v11-linux-ia32.tar.gz --staged_tarball=build/stage/opencv/v3.0.0/Release/node-v11-linux-ia32.tar.gz --hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.0.0/Release/ --hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.0.0/Release/node-v11-linux-ia32.tar.gz' (1) node-pre-gyp ERR! stack at ChildProcess. (/home/labuser/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:756:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:823:5) node-pre-gyp ERR! System Linux 3.2.0-29-generic-pae node-pre-gyp ERR! command "node" "/home/labuser/node_modules/opencv/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /home/labuser/node_modules/opencv node-pre-gyp ERR! node -v v0.10.31 node-pre-gyp ERR! node-pre-gyp -v v0.5.31 node-pre-gyp ERR! not ok 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.0.0 --major=3 --runtime=node --node_abi=node-v11 --platform=linux --target_platform=linux --arch=ia32 --target_arch=ia32 --module_main=./lib/opencv --host=https://node-opencv.s3.amazonaws.com/ --module_path=/home/labuser/node_modules/opencv/build/opencv/v3.0.0/Release/node-v11-linux-ia32 --module=/home/labuser/node_modules/opencv/build/opencv/v3.0.0/Release/node-v11-linux-ia32/opencv.node --remote_path=./opencv/v3.0.0/Release/ --package_name=node-v11-linux-ia32.tar.gz --staged_tarball=build/stage/opencv/v3.0.0/Release/node-v11-linux-ia32.tar.gz --hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.0.0/Release/ --hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.0.0/Release/node-v11-linux-ia32.tar.gz' (1) 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. 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.

npm ERR! System Linux 3.2.0-29-generic-pae npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "opencv" npm ERR! cwd /home/labuser npm ERR! node -v v0.10.31 npm ERR! npm -v 1.4.23 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/labuser/npm-debug.log npm ERR! not ok code 0

grugna avatar Feb 18 '15 21:02 grugna

What platform are you on, a quick look at it seems that it can't find the opencv header maybe

Queuecumber avatar Feb 18 '15 21:02 Queuecumber

I had the same problem

Cloning repository and running node-pre-gyp install --fallback-to-build into folder return this error:

node-pre-gyp http 403 status code downloading tarball https://node-opencv.s3.amazonaws.com/opencv/v3.0.0/Release/node-v14-darwin-x64.tar.gz (falling back to source compile with node-gyp) 

probably host binary https://node-opencv.s3.amazonaws.com is down

ocordeiro avatar Feb 19 '15 00:02 ocordeiro

@alamcordeiro are you also getting ../src/OpenCV.h:9:23: fatal error: opencv/cv.h: No such file or directory compilation terminated. in your build log?

Queuecumber avatar Feb 19 '15 00:02 Queuecumber

No :/

npm-debug.log : https://gist.github.com/alamcordeiro/dc61ff1fe09a958ca83c

ocordeiro avatar Feb 19 '15 03:02 ocordeiro

Then your issue is likely different, can you post the non-verbose log I can't parse so much information

Queuecumber avatar Feb 19 '15 04:02 Queuecumber

i tryed on ubuntu 14.04 and ubuntu 12.04. Yes, i guessed that could be one possible error, but how can make it find it?

grugna avatar Feb 19 '15 04:02 grugna

Well how are you installing opencv? You should be doing sudo apt-get install libopencv-dev or something similar I forget the exact command

Queuecumber avatar Feb 19 '15 04:02 Queuecumber

exactly! i've done that and i've also tryed other times with this: http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html

http://milq.github.io/install-opencv-ubuntu-debian/

I run the test on opencv, and it worked, but i got the error i posted when i try the command 'npm install opencv'. So probably there is a problem on this part. Node and opencv alone are working.

grugna avatar Feb 19 '15 05:02 grugna

I made a package.json with the following content

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "cal.js",
  "author": "",
  "dependencies": {
    "opencv": "^3.0.0"
  }
}

and ran npm install in the directory. Grabbing the rebuilt binaries did fail (sort of) but it fell back to the local build which worked fine. I am on ubuntu 14.04. Try following these exact steps and also check that you have /usr/include/opencv

Queuecumber avatar Feb 19 '15 13:02 Queuecumber

Do you mean to run it in the directory of package.json or in the opencv directory? Maybe you find the problem, i checked, but i have no /usr/include/opencv

grugna avatar Feb 19 '15 17:02 grugna

I haven't changed anything yet, but the error changed:

luca@luca-VirtualBox:~$ npm install opencv \

[email protected] install /home/luca/node_modules/opencv node-pre-gyp install --fallback-to-build

[opencv] Command failed: /usr/local/bin/node --eval require('/home/luca/node_modules/opencv/build/opencv/v3.0.0/Release/node-v14-linux-x64/opencv.node') module.js:355 Module._extensions[extension](this, filename); ^ Error: libopencv_core.so.2.3: cannot open shared object file: No such file or directory at Error (native) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at [eval]:1:1 at Object.exports.runInThisContext (vm.js:74:17) at Object. ([eval]-wrapper:6:22) at Module._compile (module.js:460:26) at evalScript (node.js:431:25)

node-pre-gyp ERR! Testing pre-built binary failed, attempting to source compile child_process: customFds option is deprecated, use stdio instead. child_process: customFds option is deprecated, use stdio instead. make: Entering directory /home/luca/node_modules/opencv/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/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 SOLINK_MODULE(target) Release/obj.target/opencv.node SOLINK_MODULE(target) Release/obj.target/opencv.node: Finished COPY Release/opencv.node COPY /home/luca/node_modules/opencv/build/opencv/v3.0.0/Release/node-v14-linux-x64/opencv.node TOUCH Release/obj.target/action_after_build.stamp make: Leaving directory/home/luca/node_modules/opencv/build' [email protected] node_modules/opencv ├── [email protected] ├── [email protected] └── [email protected]

grugna avatar Feb 19 '15 17:02 grugna

Thats not an error thats it working

Queuecumber avatar Feb 19 '15 17:02 Queuecumber

Also you run npm install in the directory of your package.json, are you sure you know how to use node.js and you wouldn't be more comfortable working in another language?

Queuecumber avatar Feb 19 '15 17:02 Queuecumber

I'm definetly not an expert, but i'm learning. Anyway i run some test and it is working now. Thank you for you patience

grugna avatar Feb 19 '15 17:02 grugna

Great go ahead and close the issue then

Edit: Good luck with your thesis

Queuecumber avatar Feb 19 '15 17:02 Queuecumber

@alamcordeiro lets move on to you then, go ahead and open a new issue with your details or point me to the one you already opened

Queuecumber avatar Feb 19 '15 17:02 Queuecumber

How did you manage to solve this? I'm getting the same error. The binary not being available doesn't help either.

-
> [email protected] install /home/admin/staging/1463964194/node_modules/opencv
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://node-opencv.s3.amazonaws.com/opencv/v5.0.0/Release/node-v14-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v14 ABI) (falling back to source compile with node-gyp)
make: Entering directory `/home/admin/staging/1463964194/node_modules/opencv/build'
  CXX(target) Release/obj.target/opencv/src/init.o
In file included from ../src/init.cc:1:0:
../src/OpenCV.h:19:23: fatal error: opencv/cv.h: No such file or directory
compilation terminated.
make: *** [Release/obj.target/opencv/src/init.o] Error 1
make: Leaving directory `/home/admin/staging/1463964194/node_modules/opencv/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1078:12)
gyp ERR! System Linux 3.2.0-77-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/admin/staging/1463964194/node_modules/opencv/build/opencv/v5.0.0/Release/node-v14-linux-x64/opencv.node" "--module_name=opencv" "--module_path=/home/admin/staging/1463964194/node_modules/opencv/build/opencv/v5.0.0/Release/node-v14-linux-x64"
gyp ERR! cwd /home/admin/staging/1463964194/node_modules/opencv
gyp ERR! node -v v0.12.14
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/admin/staging/1463964194/node_modules/opencv/build/opencv/v5.0.0/Release/node-v14-linux-x64/opencv.node --module_name=opencv --module_path=/home/admin/staging/1463964194/node_modules/opencv/build/opencv/v5.0.0/Release/node-v14-linux-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/admin/staging/1463964194/node_modules/opencv/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:1019:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1091:5)
node-pre-gyp ERR! System Linux 3.2.0-77-generic
node-pre-gyp ERR! command "node" "/home/admin/staging/1463964194/node_modules/opencv/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/admin/staging/1463964194/node_modules/opencv
node-pre-gyp ERR! node -v v0.12.14
node-pre-gyp ERR! node-pre-gyp -v v0.6.28
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/admin/staging/1463964194/node_modules/opencv/build/opencv/v5.0.0/Release/node-v14-linux-x64/opencv.node --module_name=opencv --module_path=/home/admin/staging/1463964194/node_modules/opencv/build/opencv/v5.0.0/Release/node-v14-linux-x64' (1)
npm ERR! Linux 3.2.0-77-generic
npm ERR! argv "node" "/usr/local/bin/npm" "install" "peterbraden/node-opencv"
npm ERR! node v0.12.14
npm ERR! npm  v2.7.6
npm ERR! code ELIFECYCLE

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.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/admin/staging/1463964194/npm-debug.log

madhatter42 avatar May 23 '16 06:05 madhatter42