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

Problem install #378

Closed
Royalxm opened this issue Feb 24, 2016 · 7 comments
Closed

Problem install #378

Royalxm opened this issue Feb 24, 2016 · 7 comments

Comments

@Royalxm
Copy link

Royalxm commented Feb 24, 2016

Hey
i have install opencv-2.4.11
PATH add
Visual studio installed

so i run npm install opencv :

> `C:\Users\Royal\Desktop\Programmation\test>npm install opencv
> 
> > opencv@5.0.0 install C:\Users\Royal\Desktop\Programmation\node_modules\opencv
> > node-pre-gyp install --fallback-to-build
> 
> 
> C:\Users\Royal\Desktop\Programmation\node_modules\opencv>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean )  else (node  clean )
> 
> C:\Users\Royal\Desktop\Programmation\node_modules\opencv>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64 )  else (node  configure --fallback-to-build --module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64 )
> C:\Users\Royal\Desktop\Programmation\node_modules\opencv\utils\find-opencv.js:39
>             throw new Error("ERROR: OPENCV_DIR doesn't seem to be defined");
>             ^
> 
> Error: ERROR: OPENCV_DIR doesn't seem to be defined
>     at C:\Users\Royal\Desktop\Programmation\node_modules\opencv\utils\find-opencv.js:39:19
>     at ChildProcess.exithandler (child_process.js:204:7)
>     at emitTwo (events.js:87:13)
>     at ChildProcess.emit (events.js:172:7)
>     at maybeClose (internal/child_process.js:818:16)
>     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
> gyp: Call to 'node utils/find-opencv.js --libs' returned exit status 1. while trying to load binding.gyp
> gyp ERR! configure error
> gyp ERR! stack Error: `gyp` failed with exit code: 1
> gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
> gyp ERR! stack     at emitTwo (events.js:87:13)
> gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
> gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
> gyp ERR! System Windows_NT 10.0.10586
> gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\Royal\\Desktop\\Programmation\\node_modules\\opencv\\build\\opencv\\v5.0.0\\Release\\node-v47-win32-x64\\opencv.node" "--module_name=opencv" "--module_path=C:\\Users\\Royal\\Desktop\\Programmation\\node_modules\\opencv\\build\\opencv\\v5.0.0\\Release\\node-v47-win32-x64"
> gyp ERR! cwd C:\Users\Royal\Desktop\Programmation\node_modules\opencv
> gyp ERR! node -v v5.3.0
> gyp ERR! node-gyp -v v3.0.3
> gyp ERR! not ok
> node-pre-gyp ERR! build error
> node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64' (1)
> node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Royal\Desktop\Programmation\node_modules\opencv\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
> node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
> node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
> node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:818:16)
> node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
> node-pre-gyp ERR! System Windows_NT 10.0.10586
> node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Royal\\Desktop\\Programmation\\node_modules\\opencv\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
> node-pre-gyp ERR! cwd C:\Users\Royal\Desktop\Programmation\node_modules\opencv
> node-pre-gyp ERR! node -v v5.3.0
> node-pre-gyp ERR! node-pre-gyp -v v0.6.17
> node-pre-gyp ERR! not ok
> Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64' (1)
> npm WARN ENOENT ENOENT: no such file or directory, open 'C:\Users\Royal\Desktop\Programmation\package.json'
> npm WARN EPACKAGEJSON Programmation No description
> npm WARN EPACKAGEJSON Programmation No repository field.
> npm WARN EPACKAGEJSON Programmation No README data
> npm WARN EPACKAGEJSON Programmation No license field.
> npm ERR! Windows_NT 10.0.10586
> npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "opencv"
> npm ERR! node v5.3.0
> npm ERR! npm  v3.3.12
> npm ERR! code ELIFECYCLE
> 
> npm ERR! opencv@5.0.0 install: `node-pre-gyp install --fallback-to-build`
> npm ERR! Exit status 1
> npm ERR!
> npm ERR! Failed at the opencv@5.0.0 install script 'node-pre-gyp install --fallback-to-build'.
> npm ERR! Make sure you have the latest version of node.js and npm installed.
> npm ERR! If you do, 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!     C:\Users\Royal\Desktop\Programmation\test\npm-debug.log
> 
> C:\Users\Royal\Desktop\Programmation\test>opencv-2.4.11`

plz help me :( i need for school university

@cascade256
Copy link
Contributor

Hope it isn't too late, but I think this is the problem:

> Error: ERROR: OPENCV_DIR doesn't seem to be defined

You need an environment variable called OPENCV_DIR set to the folder where you put OpenCV. There is more information in the README.md here: https://github.com/peterbraden/node-opencv/blob/master/README.md

You can set the variable, until you close the command prompt, with something like this (change the path to match your setup):

set OPENCV_DIR=C:\OpenCV\build\x64\vc12

You will also need to make sure that the OpenCV bin folder is in you PATH environment variable.
Good luck!

@Royalxm
Copy link
Author

Royalxm commented Feb 29, 2016

I set opencv dir :/

http://image.noelshack.com/fichiers/2016/09/1456739332-sans-titre.png

ok i fix this now i have this erreur

gyp ERR! build error gyp ERR! stack Error:C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node" "--module_name=opencv" "--module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64"
gyp ERR! cwd C:\Users\Royal\Desktop\Programmation\node_modules\opencv
gyp ERR! node -v v5.3.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Royal\Desktop\Programmation\node_modules\opencv\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 10.0.10586
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Royal\Desktop\Programmation\node_modules\opencv\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Royal\Desktop\Programmation\node_modules\opencv
node-pre-gyp ERR! node -v v5.3.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.17
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64' (1)
npm WARN ENOENT ENOENT: no such file or directory, open 'C:\Users\Royal\Desktop\Programmation\package.json'
npm WARN EPACKAGEJSON Programmation No description
npm WARN EPACKAGEJSON Programmation No repository field.
npm WARN EPACKAGEJSON Programmation No README data
npm WARN EPACKAGEJSON Programmation No license field.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "opencv"
npm ERR! node v5.3.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE

npm ERR! opencv@5.0.0 install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv@5.0.0 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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! C:\Users\Royal\Desktop\Programmation\test2\npm-debug.log`

@Royalxm
Copy link
Author

Royalxm commented Feb 29, 2016

Oh shit MSBuild 14 u_u

@cascade256
Copy link
Contributor

Did you get it working? If not, maybe post the log that is mentioned at the end of the output.

@Royalxm
Copy link
Author

Royalxm commented Mar 1, 2016

c:\opencv\build\include\opencv2\flann\any.h(48): error C2039: 'type_info' :

:'(

nativemat.cc c:\opencv\build\include\opencv2\flann\any.h(48): error C2039: 'type_info' : n'est pas membre de 'std' [C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\test_nativemat.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\map(15): note: voir la déclaration de 'std' c:\opencv\build\include\opencv2\flann\any.h(60): error C2039: 'type_info' : n'est pas membre de 'std' [C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\test_nativemat.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\map(15): note: voir la déclaration de 'std' c:\opencv\build\include\opencv2\flann\any.h(80): note: voir la référence à l'instanciation de la classe modèle 'cvflann::anyimpl::typed_base_any_policy<T>' en cours de compilation with [ T=cvflann::flann_centers_init_t ] c:\opencv\build\include\opencv2\flann\any.h(102): note: voir la référence à l'instanciation de la classe modèle 'cvflann::anyimpl::big_any_policy<cvflann::flann_centers_init_t>' en cours de compilation c:\opencv\build\include\opencv2\flann\any.h(302): error C2039: 'type_info' : n'est pas membre de 'std' [C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\test_nativemat.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\map(15): note: voir la déclaration de 'std' gyp ERR! build error gyp ERR! stack Error:C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node" "--module_name=opencv" "--module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64"
gyp ERR! cwd C:\Users\Royal\Desktop\Programmation\node_modules\opencv
gyp ERR! node -v v5.3.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Royal\Desktop\Programmation\node_modules\opencv\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 10.0.10586
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Royal\Desktop\Programmation\node_modules\opencv\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Royal\Desktop\Programmation\node_modules\opencv
node-pre-gyp ERR! node -v v5.3.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.17
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Royal\Desktop\Programmation\node_modules\opencv\build\opencv\v5.0.0\Release\node-v47-win32-x64' (1)
npm WARN ENOENT ENOENT: no such file or directory, open 'C:\Users\Royal\Desktop\Programmation\package.json'
npm WARN EPACKAGEJSON Programmation No description
npm WARN EPACKAGEJSON Programmation No repository field.
npm WARN EPACKAGEJSON Programmation No README data
npm WARN EPACKAGEJSON Programmation No license field.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "opencv"
npm ERR! node v5.3.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE

npm ERR! opencv@5.0.0 install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv@5.0.0 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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! C:\Users\Royal\Desktop\Programmation\test2\npm-debug.log
`

@Royalxm Royalxm closed this as completed Mar 2, 2016
@zshn25
Copy link

zshn25 commented Jun 29, 2016

@Royalxm Did you get it to work? Can you tell me how?

@BeatriceThalo
Copy link

BeatriceThalo commented Oct 19, 2016

@zshn25

  • Step 1, download OpenCV version 2.4(.13) and extract it to your C: drive.
  • Step 2, set environment variables. The solution to the ERROR: OPENCV_DIR I believe is reopening a cmd prompt after setting the system (not user) environment variables.

Create a system variable called OPENCV_DIR and set it to C:\OpenCV\build\x64\vc12
Make sure the "x64" part matches the version of NodeJS you are using. You can tell by whether nodejs is installed in C:\Program Files or Program Files (x86).
Also add the following to your system PATH ;%OPENCV_DIR%\bin

  • Step 3, get a C++ compiler. Any node-gyp errors regarding python, WindowsSDKDir, or CL.exe were resolved without using Visual Studio at all, but rather the Windows Option 1 in the node-gyp readme:

from anywhere run >>npm install --global --production windows-build-tools

Go to C:\OpenCV\build\include\opencv2\flann\any.h and change all references of 'std::type_info' to 'type_info'

  • Step 5, from within your project's directory, run >>npm install opencv --save. (No need to download the github repo first/separately.)
  • Step 6, prove it works. Create a new prove.js script in your project's root directory containing this:
var cv=require('opencv');
cv.readImage("node_modules/opencv/examples/files/mona.png", function(err, im){
  im.detectObject(cv.FACE_CASCADE, {}, function(err, faces){
        for (var i=0;i<faces.length; i++){
            var x = faces[i]
            im.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2);
        }
        im.save('./out.jpg');
    });
});

From within your project's directory, run >>node prove.js and verify that the new image yourProject\out.jpg has a red circle on her face.

Hope that helps.

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