Reputation: 103
I would like to install OpenCV in windows to get the library in NodeJS. But I am recurrently having some issues.
Failed at the [email protected] install "node-pre-gyp install --fallback-to-build.
This is most likely a problem with opencv package.
What is the way to get the Peterbraden package installed with avoiding this error message? Command is npm install opencv
.
Below is the output in a file after running command:
[email protected]
install C:\node_modules\opencv node-pre-gyp install --fallback-to-build
C:\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:\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:\node_modules\opencv\build\opencv\v5.0.0\Release\node-v46-win32-ia32\opencv.node --module_name=opencv --module_path=C:\node_modules\opencv\build\opencv\v5.0.0\Release\node-v46-win32-ia32 ) else (node "" configure --fallback-to-build --module=C:\node_modules\opencv\build\opencv\v5.0.0\Release\node-v46-win32-ia32\opencv.node --module_name=opencv --module_path=C:\node_modules\opencv\build\opencv\v5.0.0\Release\node-v46-win32-ia32 ) Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\node_modules\opencv\build\opencv\v5.0.0\Release\node-v46-win32-ia32\opencv.node --module_name=opencv --module_path=C:\node_modules\opencv\build\opencv\v5.0.0\Release\node-v46-win32-ia32' (1)
Upvotes: 3
Views: 4724
Reputation: 1
I ran into this same issue yesterday. I believe the build script is no longer properly installing node-gyp and node-pre-gyp. Here are the steps I completed to resolve the build errors. These steps force the installation of both of those dependencies both globally and at the project level.
Hope you have the same success I did.
Upvotes: 0
Reputation: 159
I had similar issues even using virtual boxes prepared to be used with OpenCV and node.js - both Vagrant and Docker.
After few sleepless nights I somehow figured out what was wrong on my machines. First I tried to figure out if OpenCV is installed and where. I was troubleshooting on Linux (Centos) and on Mac OS X.
Solution for me was:
Ok that was Unix systems. Windows are a bit different but checklist is probably about the same.
That can be done in Computer > Properties > Advanced System Settings
In System properties windows click Advanced tab and then Environment Variables button.
In Environment Variables add to System Properties:
OPENCV_DIR with value: C:\OpenCV\build\x64\vc12
PATH append to your path: ;%OPENCV_DIR%\bin
If all above is check, then perhaps you can also check if pkg config is installed: How to install pkg config in windows?
Hope this helps.
Upvotes: 0