Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了node.js – 使用NPM在Windows 8上安装node和opencv大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我似乎在 Windows 8上使用Npm安装opencv时出现问题,并且想知道是否有人可以提供一些指示.

错误如下,我知道显而易见的是安装pkg-config但我似乎无法找到有关如何执行此操作的任何文档?:

C:\Users\Marc>npm install opencv
\
> opencv@0.5.0 preinstall C:\Users\Marc\node_modules\opencv
> node-gyp clean rebuild


C:\Users\Marc\node_modules\opencv>node "C:\Program Files\nodejs\node_modules\n
pm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean rebuild

'pkg-config' is not recognized as an internal or external command,operable program or batch file.
gyp: Call to 'pkg-config --libs opencv' returned exit status 1. 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:\Program Files\nodejs\node_module
s\npm\node_modules\node-gyp\lib\configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "clean" "rebuild"
gyp ERR! cwd C:\Users\Marc\node_modules\opencv
gyp ERR! node -v v0.10.30
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
npm ERR! opencv@0.5.0 preinstall: `node-gyp clean rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv@0.5.0 preinstall script.
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-gyp clean rebuild
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! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "opencv"
npm ERR! cwd C:\Users\Marc
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\Marc\npm-debug.log
npm ERR! not ok @R_149_6756@

解决方法

我仍然在努力使用VS2013在win8中进行此操作,但我在 http://www.gtk.org/download/win32.php找到了我需要的几个依赖项.你可以在那里找到pkg-config以及它依赖的其他一些东西.我已经做过的所有事情的答案都是在 How to install pkg config in windows?.我现在正在处理不同的问题,但我希望这会有所帮助!

updatE

我现在在笔记本电脑上工作了.在相信所有安装的pkg-config及其依赖项之后,我相信这个秘密是opencv.pc文件.它必须指向你的opencv的安装,并指向一堆libs版本.以下是我的最终结果:

# Package Information for pkg-config

prefix=C:/OpenCV249/opencv
exec_prefix=${prefix}/bin
libdir=${prefix}/build/x64/vc11/lib
includedir_old=${prefix}/build/include/opencv
includedir_new=${prefix}/build/include

Name: OpenCV
Description: open source Computer Vision Library
Version: 2.4.9
Libs: ${libdir}/opencv_core249 ${libdir}/opencv_imgproc249 ${libdir}/opencv_highgui249 ${libdir}/opencv_ml249 ${libdir}/opencv_video249 ${libdir}/opencv_features2d249 ${libdir}/opencv_calib3d249 ${libdir}/opencv_objdetect249 ${libdir}/opencv_contrib249 ${libdir}/opencv_legacy249 ${libdir}/opencv_flAnn249

Cflags:${includedir_olD} ${includedir_new}

我将此文件放在其自己的文件夹中,然后创建PKG_CONfig_PATH环境变量,并将该文件夹作为其值.如果我感到雄心勃勃,也许我会看看我是否可以使用OpenCV 3.0.0.

我希望这有帮助!

大佬总结

以上是大佬教程为你收集整理的node.js – 使用NPM在Windows 8上安装node和opencv全部内容,希望文章能够帮你解决node.js – 使用NPM在Windows 8上安装node和opencv所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。