justadudewhohacks / opencv4nodejs

Nodejs bindings to OpenCV 3 and OpenCV 4
MIT License
4.97k stars 827 forks source link

Problems with "npm install --save opencv4nodejs" #717

Open trsh opened 4 years ago

trsh commented 4 years ago
CMake Error at CMakeLists.txt:135 (project):
  Generator

    Visual Studio 15 2017 Win64

  could not find any instance of Visual Studio.

Im am on 2019 Win64. How can I fix the install process?

trsh commented 4 years ago

After installing older build tools, seems I got further, but still error at end:

info install starting build...
events.js:200
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe',
  path: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe',
  spawnargs: [ './OpenCV.sln', '/p:Configuration=Release', '/p:Platform=x64' ]
trsh commented 4 years ago

An why does default installation "npm install --save opencv4nodejs" use 3 (old) version?

Bioswami-nfac commented 4 years ago

I am having the exact same issue. Is this because of the whitespaces in the path to MSBUILD.exe?

Bioswami-nfac commented 4 years ago

Is there a way to specify the MSBUILD.exe path on the command line? I am using git BASH to run npm install --save opencv4nodejs.

I can see that my MSBuild.exe is under C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe' where is it looking for it under

C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe'

I created the 15.0\Bin directory and placed a shortcut to MSBuil.exe in there but no dice.

Would appreciate any help on this. Looks like I am so near yet so far :)

trsh commented 4 years ago

No idea, I gave up and used Python

Bioswami-nfac commented 4 years ago

I can't do that because this is for my electron desktop app. Need this pretty bad.

trsh commented 4 years ago

@Bioswami-nfac what functionality u need to use? Maybe the pure JS version is good enough for u?

Bioswami-nfac commented 4 years ago

I need to use the video capture and factial recognition modules.

Have been trying to install it manually as well using OpenCV that I installed separately but running into the node-gyp issues. Error 1083.

Regards,

Arun

On Sun, Jun 7, 2020 at 12:25 PM trsh notifications@github.com wrote:

@Bioswami-nfac https://github.com/Bioswami-nfac what functionality u need to use? Maybe the pure JS version is good enough for u?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/justadudewhohacks/opencv4nodejs/issues/717#issuecomment-640167532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD46VFMUCIPVOZUUDUPMHHDRVM2W3ANCNFSM4M3NPOZQ .

-- Arun Krishnan, Ph.D Founder & CEO, nFactorial Analytical Sciences,

Email: arun@nfactorialanalytics.com Phone: +91 9880007615 URL: https://www.nfactorialanalytics.com http://www.nfactorialanalytics.com Short Product Video: http://bit.ly/Intro2nGage

n!Gage, n!Factorial’s real-time employee engagement feedback platform http://bit.ly/Intro2nGage, helps managers listen, understand and act upon employee feedback that leads to great employee experiences and ultimately, deeper engagement. This first-of-its-kind-in-India-platform uses analytics to provide real-time intervention analysis, trends, predictive analysis and much more. Winner of TechHR’s 2016 Spotlight award https://www.peoplematters.in/article/hr-technology/spotlight-award-winners-2016-13817, the platform is in use in several large corporations across multiple industries.

Bioswami-nfac commented 4 years ago

OK. I figured it out and it worked for me. Hopefully, this will be useful for others.

The instructions for manual installation require that the environment variable OPENCV_INCLUDE_DIR pointing to the directory with the subfolder opencv2 containing the header files

I had erroneously pointed it to the opencv2 directory. As a result it was not able to find the hpp files. Once I fixed the environment variable correctly, it built the opencv4nodejs for me.

lichenglong-blog commented 4 years ago

我研究了一天终于终于成功了,我删除了node_modules, package.json的子属性配置了opencv4nodejs。 然后我再npm install --save opencv4nodejs就成功了(前提可能还有要配置好opencv系统环境变量和cmake、git插件和 Visual Studio的系统变量,我的node版本最后调整了v14.8.0)。

捕获04点04分1 捕获 捕获04点04分
lichenglong-blog commented 4 years ago

我可能在终端控制台使用过了export OPENCV4NODEJS_DISABLE_AUTOBUILD=1或者set OPENCV4NODEJS_DISABLE_AUTOBUILD=1,但不知道最后安装成功有没有使用命令,也不知道这命令会不会有作用。我的经验可能就这么多,有帮助的话点个赞👍b( ̄▽ ̄)d

mdnpascual commented 3 years ago

Is there a way to specify the MSBUILD.exe path on the command line? I am using git BASH to run npm install --save opencv4nodejs.

I can see that my MSBuild.exe is under C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe' where is it looking for it under

C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe'

I created the 15.0\Bin directory and placed a shortcut to MSBuil.exe in there but no dice.

Would appreciate any help on this. Looks like I am so near yet so far :)

I just npm installed this package and had the exact same problem. I had VS2019 installed and also the 2017 build tools.

I tried specifying npm config set msbuild_path <path to 2017 msbuild> and npm config set msvs_version 2017 as per some answers in the interwebs but no dice.

What I ended up doing is copying 2017\BuildTools\MSBuild\15.0 folder to Microsoft Visual Studio\2019\Community\MSBuild\15.0 and also temporary renaming Microsoft Visual Studio\2019\Community\Common7 to something else and then copying 2017\BuildTools\Common7 to replace that