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

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

Open
trsh opened this issue May 7, 2020 · 12 comments
Open

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

trsh opened this issue May 7, 2020 · 12 comments

Comments

@trsh
Copy link

trsh commented May 7, 2020

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
Copy link
Author

trsh commented May 7, 2020

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
Copy link
Author

trsh commented May 7, 2020

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

@Bioswami-nfac
Copy link

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

@Bioswami-nfac
Copy link

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
Copy link
Author

trsh commented Jun 6, 2020

No idea, I gave up and used Python

@Bioswami-nfac
Copy link

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

@trsh
Copy link
Author

trsh commented Jun 7, 2020

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

@Bioswami-nfac
Copy link

Bioswami-nfac commented Jun 7, 2020 via email

@Bioswami-nfac
Copy link

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
Copy link

我研究了一天终于终于成功了,我删除了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
Copy link

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

@mdnpascual
Copy link

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

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