Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Windows Global Install for opencv4nodejs

Installation

Start with node-gyp

You can install with npm:

$ npm install -g node-gyp

You will also need to install:

On Windows

Option 1 (what I've used)

From an elevated PowerShell or CMD.exe (run as Administrator), install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools.

If you already have Visual Studio installed, then Visual Studio Build Tools may fail. In that case launch cmd and enter npm config set msvs_version 2017.

Option 2

Install tools and configuration manually:

  • Install Visual C++ Build Environment: Visual Studio Build Tools (using "Visual C++ build tools" workload) or Visual Studio 2017 Community (using the "Desktop development with C++" workload)
  • Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7 (or see below for further instructions on specifying the proper Python version and path.)
  • Launch cmd, npm config set msvs_version 2017

If the above steps didn't work for you, please visit Microsoft's Node.js Guidelines for Windows for additional tips.

If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:

$ node-gyp --python /path/to/python2.7

If node-gyp is called by way of npm, and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:

$ npm config set python /path/to/executable/python2.7

If windows-build-tools was installed, the Python 2.7 path should be C:\Users\<user>\.windows-build-tools\python27\.

Use the command below to check npm's 'python' config key value:

$ npm config get python

Install CMake

Download and install x64 version from: CMake Downloads

Add to PATH during install

Will need to execute remaining commands in new terminal for cmake to be recognized. Use cmake --version to confirm that it's installed and available.


Install opencv4nodejs:

Auto build

Verify that git is installed by using git --version; install if necessary.

If you do not want to set up OpenCV on your own you can simply let this package auto install OpenCV 3.4 + OpenCV contrib 3.4 (might take some time):

$ npm i -g opencv4nodejs

I've gotten errors about Visual Studio on a clean install (using just the windows-build-tools; not Visual Studio), and resolved that with a restart. I had also installed Visual Studio Build Tools, but the restart might have been all that was needed.

In order to prevent build errors during an npm install, your package.json should not include opencv4nodejs, and instead should include/require the global package either by requiring it by absolute path or setting the NODE_PATH environment variable to /usr/lib/node_modules in your Dockerfile and requiring the package as you normally would.

I chose to add a NODE_PATH environment variable. The install path will be displayed in the output of the previous command, but for me it was in C:\Users\<user>\AppData\Roaming\npm\node_modules.

@huahaofeng

This comment has been minimized.

Copy link

@huahaofeng huahaofeng commented Jun 28, 2019

Thank you very much, it helps a lot!! Now I successfully global installed opencv4nodejs with npm, and know how to require it in my code.

@adwellj

This comment has been minimized.

Copy link
Owner Author

@adwellj adwellj commented Jun 28, 2019

@huahaofeng, I'm glad it helped :)

@hAbd0u

This comment has been minimized.

Copy link

@hAbd0u hAbd0u commented Jul 2, 2019

Following your steps reduced some errors I was getting but still this s not fixed:


> opencv4nodejs@5.1.0 install m:\taxi-detector\node_modules\opencv4nodejs
> node-gyp rebuild --jobs max


m:\taxi-detector\node_modules\opencv4nodejs>if not defined npm_config_node_gyp (node "C:\Users\Mr B\AppData\Roaming\npm\node_modules\npm\nod
e_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --jobs max )  else (node "C:\Users\Mr B\AppData\R
oaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --jobs max )
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(374,5): warning MSB8003:
 Could not find VCToolsInstallDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version n
umber. [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  opencv4nodejs.cc
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  CustomMatAllocator.cc
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  ExternalMemTracking.cc
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  core.cc
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  coreConstants.cc
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  Mat.cc
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  Point.cc
  Vec.cc
cl : Command line warning D9002: ignoring unknown option '/diagnostics:classic' [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  Size.cc
  Rect.cc
  RotatedRect.cc
  TermCriteria.cc
c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\corecrt.h(10): fatal error C1083: Cannot open include file: 'vcruntime.h':
 No such file or directory (compiling source file ..\cc\opencv4nodejs.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.
vcxproj]
  imgproc.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\ExternalMemTracking.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\opencv4nodejs\cc\custommatallocator.h(4): fatal error C1083: Cannot open include file: 'thread': No such file
 or directory (compiling source file ..\cc\CustomMatAllocator.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  imgprocConstants.cc
  MatImgproc.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\core\Mat.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\core\Point.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\core\core.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\core\coreConstants.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
e:\downloads\programs\opencv\build\include\opencv2\core\cvdef.h(164): fatal error C1083: Cannot open include file: 'limits.h': No such file
 or directory (compiling source file ..\cc\core\TermCriteria.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\core\RotatedRect.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
e:\downloads\programs\opencv\build\include\opencv2\core\cvdef.h(164): fatal error C1083: Cannot open include file: 'limits.h': No such file
 or directory (compiling source file ..\cc\core\Rect.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
e:\downloads\programs\opencv\build\include\opencv2\core\cvdef.h(164): fatal error C1083: Cannot open include file: 'limits.h': No such file
 or directory (compiling source file ..\cc\core\Size.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  Contour.cc
  Moments.cc
  calib3d.cc
  calib3dConstants.cc
  MatCalib3d.cc
  io.cc
  ioConstants.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\core\Vec.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  VideoCapture.cc
  VideoWriter.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\imgproc\MatImgproc.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  photo.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\imgproc\imgproc.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  photoConstants.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\imgproc\Contour.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\imgproc\Moments.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  video.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\calib3d\calib3d.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\imgproc\imgprocConstants.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  BackgroundSubtractor.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\io\VideoCapture.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\io\io.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  BackgroundSubtractorMOG2.cc
  BackgroundSubtractorKNN.cc
  ximgproc.cc
  MatXimgproc.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\io\VideoWriter.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\io\ioConstants.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\calib3d\MatCalib3d.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  SuperpixelSEEDS.cc
  SuperpixelSLIC.cc
  SuperpixelLSC.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\calib3d\calib3dConstants.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  objdetect.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\photo\photoConstants.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  CascadeClassifier.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\video\BackgroundSubtractor.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\video\BackgroundSubtractorMOG2.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxp
roj]
  HOGDescriptor.cc
  DetectionROI.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\video\BackgroundSubtractorKNN.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxpr
oj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\ximgproc\MatXimgproc.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\video\video.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  machinelearning.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\photo\photo.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  machinelearningConstants.cc
  ParamGrid.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\ximgproc\ximgproc.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  StatModel.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\ximgproc\SuperpixelSLIC.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  SVM.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\objdetect\objdetect.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrainData.cc
  dnn.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\ximgproc\SuperpixelLSC.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  Net.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\ximgproc\SuperpixelSEEDS.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  face.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\objdetect\CascadeClassifier.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj
]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\objdetect\DetectionROI.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  FaceRecognizer.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\objdetect\HOGDescriptor.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  EigenFaceRecognizer.cc
  FisherFaceRecognizer.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\machinelearning\machinelearningConstants.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4n
odejs.vcxproj]
  LBPHFaceRecognizer.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\machinelearning\SVM.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\machinelearning\machinelearning.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcx
proj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\machinelearning\StatModel.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  Facemark.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\machinelearning\ParamGrid.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  FacemarkAAM.cc
  FacemarkAAMData.cc
  FacemarkAAMParams.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\machinelearning\TrainData.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\dnn\dnn.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\dnn\Net.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  FacemarkLBF.cc
  FacemarkLBFParams.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\face.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  text.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\FaceRecognizer.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  OCRHMMClassifier.cc
  OCRHMMDecoder.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\EigenFaceRecognizer.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  tracking.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\FisherFaceRecognizer.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  Tracker.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\FacemarkAAMData.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\FacemarkAAM.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  MultiTracker.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\Facemark.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\FacemarkAAMParams.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrackerBoosting.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\FacemarkLBF.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\LBPHFaceRecognizer.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrackerBoostingParams.cc
  TrackerKCF.cc
  TrackerKCFParams.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\face\FacemarkLBFParams.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrackerMIL.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\text\text.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrackerMILParams.cc
  TrackerMedianFlow.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\text\OCRHMMClassifier.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrackerTLD.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\text\OCRHMMDecoder.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\tracking.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrackerGOTURN.cc
  TrackerCSRT.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\MultiTracker.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrackerCSRTParams.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerKCF.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxpro
j]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerKCFParams.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.
vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerBoostingParams.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4no
dejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Tracker.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  TrackerMOSSE.cc
  features2d.cc
  KeyPoint.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerBoosting.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.v
cxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerMIL.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxpro
j]
  KeyPointMatch.cc
  DescriptorMatch.cc
  BFMatcher.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerMILParams.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.
vcxproj]
  FeatureDetector.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerMedianFlow.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs
.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerTLD.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxpro
j]
  descriptorMatching.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerGOTURN.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcx
proj]
  descriptorMatchingKnn.cc
  AGASTDetector.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerCSRT.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxpr
oj]
  AKAZEDetector.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerMOSSE.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxp
roj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\tracking\Trackers\TrackerCSRTParams.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs
.vcxproj]
  BRISKDetector.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\KeyPoint.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  FASTDetector.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\KeyPointMatch.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  GFTTDetector.cc
  KAZEDetector.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\DescriptorMatch.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\BFMatcher.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  MSERDetector.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\FeatureDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  ORBDetector.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\features2d.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
  SimpleBlobDetector.cc
  SimpleBlobDetectorParams.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\descriptorMatching.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxpr
oj]
  xfeatures2d.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\AKAZEDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.
vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\AGASTDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.
vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\descriptorMatchingKnn.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vc
xproj]
  SIFTDetector.cc
  SURFDetector.cc
  win_delay_load_hook.cc
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\BRISKDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.
vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\KAZEDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.v
cxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\FASTDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.v
cxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\GFTTDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.v
cxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\MSERDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.v
cxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\SimpleBlobDetectorParams.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\ope
ncv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\SimpleBlobDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4no
dejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\features2d\detectors\ORBDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vc
xproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\xfeatures2d\xfeatures2d.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\xfeatures2d\SURFDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
m:\taxi-detector\node_modules\native-node-utils\src\utils.h(1): fatal error C1083: Cannot open include file: 'memory': No such file or dire
ctory (compiling source file ..\cc\xfeatures2d\SIFTDetector.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\windows.h(167): fatal error C1083: Cannot open include file: 'excpt.h': No s
uch file or directory (compiling source file C:\Users\Mr B\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_ho
ok.cc) [m:\taxi-detector\node_modules\opencv4nodejs\build\opencv4nodejs.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Mr B\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:262: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 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Mr B\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\b
in\\node-gyp.js" "rebuild" "--jobs" "max"
gyp ERR! cwd m:\taxi-detector\node_modules\opencv4nodejs
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'm:\taxi-detector\package.json'
npm WARN taxi-detector No description
npm WARN taxi-detector No repository field.
npm WARN taxi-detector No README data
npm WARN taxi-detector No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv4nodejs@5.1.0 install: `node-gyp rebuild --jobs max`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv4nodejs@5.1.0 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\Mr B\AppData\Roaming\npm-cache\_logs\2019-07-02T21_29_23_569Z-debug.log```
@adwellj

This comment has been minimized.

Copy link
Owner Author

@adwellj adwellj commented Jul 3, 2019

@hAbd0u, I'm sorry to hear that. I'm not involved with opencv4nodejs, so you might try posting on that repo if you're looking for help. I created this document mostly to help me recall my steps for installation.

@hAbd0u

This comment has been minimized.

Copy link

@hAbd0u hAbd0u commented Jul 3, 2019

@adwellj, Thank you for the post, that already was enough to me.
After days of goofling it turns out that opencv4nodejs can be compiled with VC2015 better, and if you have already VC2017 community installed which is already has VC2015 included but it seems broken as the other forum members mentioned, so what it does work for me eventually this:

npm install windows-build-tools --vs2015
npm install --prefer-offline  --vs2015  --save opencv4nodejs
@huahaofeng

This comment has been minimized.

Copy link

@huahaofeng huahaofeng commented Jul 4, 2019

@hAbd0u, try the manual way of installation which is much easier on windows.

installing-opencv-manually

  1. install opencv release, which can be found here, the version I used is 3.4.x
  2. disable auto build
OPENCV4NODEJS_DISABLE_AUTOBUILD=1
  1. set system environmental variables

TIM截图20190704100631

  1. npm install opencv4nodejs
  2. or npm install opencv4nodejs -g for global installation, and NODE_PATH should be added to system environmental variables
@femto11

This comment has been minimized.

Copy link

@femto11 femto11 commented Aug 8, 2019

Because I had problems getting my electron app running (it comlained about a module not being found in the temp folder although it was there), I also tried to manually install opencv and disable auto build as described here. The app is working now but only on my dev machine where opencv is installed. It seems like that electron builder did not move these dependencies into the packaged app. What I'm doing wrong here?

@adwellj

This comment has been minimized.

Copy link
Owner Author

@adwellj adwellj commented Aug 8, 2019

@femto11, I'm sorry to hear that. I'm not involved with opencv4nodejs, so you might try posting on that repo if you're looking for help. I created this document mostly to help me recall my steps for installation.

Unsure if it helps, but there is a section in the README for Usage with Electron.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.