opencv4nodejs
opencv4nodejs copied to clipboard
Cant build on windows 10
Using 10.3.0 nodejs on Windows 10 I run "npm install --save opencv4nodejs"
Done Building Project "C:\test\node_modules
\opencv-build\opencv\build\INSTALL.vcxproj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
After that I see lots of missing files errors and then build process fails, for example one of missing files:
C:\test\node_modules\opencv4nodejs\cc\core\
Size.h(1): fatal error C1083: Cannot open include file: 'opencv2/core.hpp': No such file or di
rectory (compiling source file ..\cc\CustomMatAllocator.cc) [C:\test\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
Are you using your own OpenCV build or the auto build. In the latter case, did the auto build(the opencv-build package)succeed/execute?
I am trying auto build
After first build/succeed message
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
and then lots of files cant be included, just copied some of names:
fatal error C1083: Cannot open include file: 'opencv2/core.hpp': No such file
or directory (compiling source file ..\cc\cvTypes\cvTypes.cc)
fatal error C1083: Cannot open include file: 'opencv2/highgui.hpp':
No such file or directory (compiling source file ..\cc\cvTypes\videoCaptureProps.cc)
fatal error C1083: Cannot open include file: 'opencv2/core.hpp': No such file
or directory (compiling source file ..\cc\core\Mat.cc)
fatal error C1083: Cannot open include file: 'opencv2/core.hpp': No such file or dir
ectory (compiling source file ..\cc\core\Vec.cc)
last lines from powershell:
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:\Users\it\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\exe\\nodejs\\node.exe" "C:\\Users\\it\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Program Files (x86)\no\node_modules\opencv4nodejs
gyp ERR! node -v v10.3.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Last lines from log:
810 verbose stack Error: [email protected] install: `node-gyp rebuild`
810 verbose stack Exit status 1
810 verbose stack at EventEmitter.<anonymous> (C:\Users\it\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
810 verbose stack at EventEmitter.emit (events.js:182:13)
810 verbose stack at ChildProcess.<anonymous> (C:\Users\it\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
810 verbose stack at ChildProcess.emit (events.js:182:13)
810 verbose stack at maybeClose (internal/child_process.js:961:16)
810 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
Can you check whether the include dir and libraries are present in node_modules/opencv-build/build? Obviously the include directory is missing.
When I am running "opencv4nodejs" installation all folders are deleted after fail. So I cant check.
This time I tried just "npm install opencv-build" - this builded opencv without any issues. and those files what was missing, is found in folders. Then I tried "npm install --save opencv4nodejs" and it failed right after git checkout:
error: unable to create file samples/winrt_universal/VideoCaptureXAML/video_capture_xaml/video_capture_xaml.WindowsPhone/video_capture_xaml.WindowsPhone.vcxproj.filters: Filename too long
error: unable to create file samples/winrt_universal/VideoCaptureXAML/video_capture_xaml/video_capture_xaml.WindowsPhone/video_capture_xaml.WindowsPhone_TemporaryKey.pfx: Filename too long
Checking out files: 100% (5879/5879), done.
fatal: unable to checkout working tree
and installing process stopped
Okay, but that's a git issue. Usually git should accept much longer filenames, so not sure whats the issue there.
Tried again, results are: npm install opencv-build - has all files what cant be found by next command npm install opencv4nodejs - cant find opencv files
Looks like issue could be in "opencv4nodejs" execution process. if running "opencv-build" on its own has all files whats needed
npm version - 6.1.0 nodejs - 10.3.0
is there anything else I could try?
Given that opencv-build indeed builds without any issue you should have an include directory at node_modules\opencv-build\opencv\build\include
, which contains the subdirectories opencv
and opencv2
with all the header files, a library directory at node_modules\opencv-build\opencv\build\lib\Release
containing the .lib
files and a binary directory node_modules\opencv-build\opencv\build\bin\Release
with .dlls
.
Not sure why the install script doesn't find the include directory in your case, but you could also disable the autobuild flag after installing opencv-build and set the envs OPENCV_INCLUDE_DIR
and OPENCV_LIB_DIR
manually to the corresponding directories.
All required Env variables was set.
info install OPENCV4NODEJS_DISABLE_AUTOBUILD is set
info install skipping auto build...
but even with it, it fails to find those files:
c:\program files (x86)\test\node_modules\opencv4nodejs\cc\core\coreUtils.h(2): fatal error C1083:
Cannot open include file: 'opencv2/core.hpp': No such file
or directory (compiling source file ..\cc\core\core.cc)
[C:\Program Files (x86)\test\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
c:\program files (x86)\test\node_modules\opencv4nodejs\cc\cvtyp
es\imgprocConstants.h(2): fatal error C1083: Cannot open include file: 'opencv2/core.hpp': No
such file or directory (compiling source file ..\cc\cvTypes\imgprocConstants.cc) [C:\Program F
iles (x86)\test\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
also checking OPENCV_INCLUDE_DIR in CMD it gives correct path. Could this issue be due npm version?
That's odd. I can't think of any reason why it complains. Not sure if it is related to npm, I am using npm 5.6.0 right now, which comes with node-gyp 3.6.2.
In case you want to debug the issue, the script node-gyp uses to get the include directory is located in lib/includes.js. You could clone the repo and replace the console.log with a throw new Error(resolvePath(process.env.OPENCV_INCLUDE_DIR))
to log and investigate the final path, since console.log doesn't print to the console in this script.
Throw also shows correct path: Error: C:/Program Files (x86)/test/node_modules/opencv-build/opencv/build/include
node-gyp -v v3.6.2
@justadudewhohacks Maybe you can share compressed "node_modules" with package.json and package-lock.json, where "face-recognition.js" "opencv4nodejs" would be installed for windows.
Thanks :+1:
I don't want to maintain precompiled versions of this package for every single operating system, node abi and OpenCV setup for every single release, sorry.
Hello, I have the same problem when i try to install the Opencv module.
772 warn [email protected] No description
773 warn [email protected] No repository field.
774 verbose stack Error: [email protected] install: node-gyp rebuild
774 verbose stack Exit status 1
774 verbose stack at EventEmitter.node-gyp rebuild
783 error Exit status 1
784 error Failed at the [email protected] install script.
784 error This is probably not a problem with npm. There is likely additional logging output above.
785 verbose exit [ 1, true ]
Could you please share the full error log? The error message is not shown in the log you posted
Hello, here it is the debug log and the terminal log.
Plus i have the python installed, but it keeps not working.
You know what I'm doing wrong in there?
I need this for a project i'm working.
Sorry for the late reply. Thanks for sharing the log. The error message clearly says that the python executable could not be found, which is required to run node-gyp:
gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "C:\Users\rafael.pereira\AppData\Local\Programs\Python\Python36-32\python.EXE", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19) gyp ERR! stack at PythonFinder.
(C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\rafael.pereira\Desktop\node\node_modules\opencv4nodejs gyp ERR! node -v v8.11.1 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok
Is python in your system path, what happens if you run python --version? Looks like you set the python environment variable to the executable rather then the directory? Try to strip python.EXE from the path, eg: C:\Users\rafael.pereira\AppData\Local\Programs\Python\Python36-32
.
Ah okay. However, this is a node-gyp issue and not the issue of opencv4nodejs. I would recommend you to look the error message up at node-gyp. Googling the error message you can already find a lot of people having the same issue as yours.
The only thing that I would suggest you to try is to set the python path in your npm config: npm config set python "C:\Users\rafael.pereira\AppData\Local\Programs\Python\Python36-32\python.exe"
. Otherwise I am clueless.
It needs Python 2 instead of 3. and now it's working.
Thanks for the support, if i find more problems i will report.
Strange, I am using python 3.5. But atleast it is working now.
Yes. Thanks for the support.
If you're running Windows 10, do yourself a HUGE favor and start using WSL (and docker if appropriate) and you'll all but stop seeing Windows specific issues while doing Nodejs dev.
Hi Team,
While installing opencv4nodejs, getting error, please assist
-
Downloaded and extracted opencv-3.4.2-vc14_vc15.exe
-
Installed build tools with "npm install --global windows-build-tools"
-
Created below environement variables OPENCV_DIR=D:\opencv OPENCV_BIN_DIR=d:\opencv\build\x64\vc14\bin OPENCV_INCLUDE_DIR=d:\opencv\build\include OPENCV_LIB_DIR=d:\opencv\build\x64\vc14\lib
OPENCV4NODEJS_DISABLE_AUTOBUILD=1 Added %OPENCV_BIN_DIR% in path varaible
Error: C:\Users\username>npm i -g opencv4nodejs
[email protected] install C:\Users\username\AppData\Roaming\npm\node_modules\opencv4nodejs\node_modules\opencv-build> node ./install.js
info install OPENCV4NODEJS_DISABLE_AUTOBUILD is set info install skipping auto build...
[email protected] install C:\Users\username\AppData\Roaming\npm\node_modules\opencv4nodejs node-gyp rebuild
C:\Users\username\AppData\Roaming\npm\node_modules\opencv4nodejs>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\username\AppData\Roaming\npm\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj(20,3): error MSB4019: The
imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is c
orrect, and that the file exists on disk.
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:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\username\AppData\Roaming\npm\node_modules\opencv4nodejs
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\username\AppData\Roaming\npm-cache_logs\2018-09-06T07_09_58_012Z-debug.log
I seem to have the exact same issue as @kolep8
c:\users\anna\desktop\vmm\sqclassifier\vmm\node_modules\opencv4nodejs\cc\modules\features2d\detectors\SimpleBlobDetectorParams.h(3): fatal error C1083: Cannot open include file: 'opencv2/features2d.hpp': No such file or directory (compiling source file ..\cc\modules\features2d\detectors\SimpleBlobDetectorParams.cc) [C:\Users\Anna\Desktop\VMM\SQclassifier\VMM\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj] gyp ERR! build error gyp ERR! stack Error:
C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exefailed with exit code: 1 gyp ERR! stack at ChildProcess.onExit(C:\Users\Anna\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:160:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Anna\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\Anna\Desktop\VMM\SQclassifier\VMM\node_modules\opencv4nodejs gyp ERR! node -v v9.5.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install:
node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Anna\AppData\Roaming\npm-cache_logs\2018-11-24T17_23_40_590Z-debug.log `
Still no dice?
As for @savtambe it seems that you have a separate issue with MSBuild as you have MSB error. You have
to look at this line in your error log:
error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
I solved my issue by using auto build and the -msvs_version=2017
flag.
First I had to delete the VCTargetsPath from Environment Variables which is used for VS 2015 only (make sure to put it back, if you want to use VS 2015 later).
I had to also make sure to close and reopen PowerShell every time I have used VS 2015 as it has left some variables set, which was messing with the VS 2017 build.
I am noting this as I have seen many recomendations to keep just one version of VS, which is clearly not needed
And finally, I had to delete the .node-gyp directory from C:\Users\<username>\
I m getting error when starting application on Ubuntu 18.04 LTS node 8.11.3 npm 6.4.1
module.js:681 return process.dlopen(module, path._makeLong(filename)); ^
Error: /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0: undefined symbol: g_log_structured_standard
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.
Did you solve the problem?
I m getting error when starting application on Ubuntu 18.04 LTS
node 8.11.3 npm 6.4.1 module.js:681 return process.dlopen(module, path._makeLong(filename)); ^
Error: /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0: undefined symbol: g_log_structured_standard at Object.Module._extensions..node (module.js:681:18) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/projectPath/node_modules/opencv4nodejs/lib/cv.js:17:8) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) [nodemon] app crashed - waiting for file changes before starting...
Did you solve the problem?