在nodejs中安装opencv时出错

时间:2017-08-03 19:11:59

标签: node.js opencv

我正在尝试在Windows 10上的nodejs中安装opencv,但是得到以下错误,可以帮助我吗?

     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:125:13)
        gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
        gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200: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" "build" "--fallback-to-build" "--module=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\opencv\\build\\opencv\\v6.0.0\\Release\\node-v57-win32-x64\\opencv.node" "--module_name=opencv" "--module_path=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\opencv\\build\\opencv\\v6.0.0\\Release\\node-v57-win32-x64"
        gyp ERR! cwd C:\Program Files\nodejs\node_modules\npm\node_modules\opencv
        gyp ERR! node -v v8.2.1
        gyp ERR! node-gyp -v v3.6.2
        gyp ERR! not ok
        node-pre-gyp ERR! build error
        node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Program Files\nodejs\node_modules\npm\node_modules\opencv\build\opencv\v6.0.0\Release\node-v57-win32-x64\opencv.node
--module_name=opencv --module_path=C:\Program Files\nodejs\node_modules\npm\node_modules\opencv\build\opencv\v6.0.0\Release\node-v57-win32-x64' (1)
        node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\opencv\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
        node-pre-gyp ERR! stack     at emitTwo (events.js:125:13)
        node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
        node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:921:16)
        node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
        node-pre-gyp ERR! System Windows_NT 10.0.15063
        node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\opencv\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
        node-pre-gyp ERR! cwd C:\Program Files\nodejs\node_modules\npm\node_modules\opencv
        node-pre-gyp ERR! node -v v8.2.1
        node-pre-gyp ERR! node-pre-gyp -v v0.6.36
        node-pre-gyp ERR! not ok
        Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Program Files\nodejs\node_modules\npm\node_modules\opencv\build\opencv\v6.0.0\Release\node-v57-win32-x64\opencv.node
--module_name=opencv --module_path=C:\Program Files\nodejs\node_modules\npm\node_modules\opencv\build\opencv\v6.0.0\Release\node-v57-win32-x64' (1)
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! opencv@6.0.0 install: `node-pre-gyp install --fallback-to-build`
        npm ERR! Exit status 1
        npm ERR!
        npm ERR! Failed at the opencv@6.0.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\suresh\AppData\Roaming\npm-cache\_logs\2017-08-03T18_05_40_307Z-debug.log

        C:\Program Files\nodejs\node_modules\npm>

1 个答案:

答案 0 :(得分:0)

尝试从here下载Visual C ++ 2015构建工具。

安装后运行此命令:

npm config -g set msvs_version 2015