我尝试用npm安装opencv。我收到以下错误。请帮忙。我被困了这么久!我的计算机上安装了python 2.7和opencv 2.4.9。
我有以下系统变量。
C:\Python27;%OPENCV_DIR%\bin
OPENCV_DIR是
c:\OpenCV\build\x64\vc14
以下是安装失败的堆栈跟踪。
$ npm install opencv
npm WARN installMany node-pre-gyp was bundled with opencv@6.0.0, but bundled package wasn't found in unpacked tree
> opencv@6.0.0 install C:\Users\Johnson\Desktop\kim\server\node_modules\opencv
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download: https://node-opencv.s3.amazonaws.com/opencv/v6.0.0/Release/node-v46-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for opencv@6.0.0 and node@4.2.6 (node-v46 ABI) (falling back to source compile with node-gyp)
C:\Users\Johnson\Desktop\kim\server\node_modules\opencv\utils\find-opencv.js:57
throw new Error("ERROR: couldn't read the lib directory " + err);
^
Error: ERROR: couldn't read the lib directory Error: ENOENT: no such file or directory, scandir 'C:\OpenCV\build\x64\vc14\lib'
at C:\Users\Johnson\Desktop\kim\server\node_modules\opencv\utils\find-opencv.js:57:23
at FSReqWrap.oncomplete (fs.js:82:15)
gyp: Call to 'node utils/find-opencv.js --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\Johnson\Desktop\kim\server\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Johnson\\Desktop\\kim\\server\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\Johnson\\Desktop\\kim\\server\\node_modules\\opencv\\build\\opencv\\v6.0.0\\Release\\node-v46-win32-x64\\opencv.node" "--module_name=opencv" "--module_path=C:\\Users\\Johnson\\Desktop\\kim\\server\\node_modules\\opencv\\build\\opencv\\v6.0.0\\Release\\node-v46-win32-x64"
gyp ERR! cwd C:\Users\Johnson\Desktop\kim\server\node_modules\opencv
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.4.0
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:\Users\Johnson\Desktop\kim\server\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Johnson\Desktop\kim\server\node_modules\opencv\build\opencv\v6.0.0\Release\node-v46-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Johnson\Desktop\kim\server\node_modules\opencv\build\opencv\v6.0.0\Release\node-v46-win32-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\Johnson\Desktop\kim\server\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:821:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 6.3.9600
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Johnson\\Desktop\\kim\\server\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Johnson\Desktop\kim\server\node_modules\opencv
node-pre-gyp ERR! node -v v4.2.6
node-pre-gyp ERR! node-pre-gyp -v v0.6.30
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Johnson\Desktop\kim\server\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Johnson\Desktop\kim\server\node_modules\opencv\build\opencv\v6.0.0\Release\node-v46-win32-x64\opencv.node --module_name=opencv --module_path=C:\Users\Johnson\Desktop\kim\server\node_modules\opencv\build\opencv\v6.0.0\Release\node-v46-win32-x64' (1)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "opencv"
npm ERR! node v4.2.6
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
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 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the opencv package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls opencv
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Johnson\Desktop\kim\server\npm-debug.log