我在Windows 8计算机上安装Canvas时遇到问题。
我需要使用hog-descriptor,为此我需要安装Canvas但是,当我尝试'npm install canvas'时,我收到此错误:
c:\users\omri\node_modules\canvas\src\Canvas.h(19): fatal error C1083: Cannot
open include file: 'cairo/cairo.h': No such file or directory (..\src\CanvasPatt
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\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:267:23)
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" "rebuild"
gyp ERR! cwd C:\iolo\scipy-0.14.0\node_modules\canvas
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! canvas@1.1.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@1.1.6 install script.
npm ERR! This is most likely a problem with the canvas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls canvas
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" "canvas"
npm ERR! cwd C:\iolo\scipy-0.14.0
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
我该如何解决这个问题?
答案 0 :(得分:1)
要解决丢失的cairo库错误,请按照说明在canvas
模块的wiki here中安装cairo。
答案 1 :(得分:0)
Canvas在某处硬编码(或者可能从node-gyp中获取提示)仅接受名为 GTK 的GTK2目录。因此,将GTK2提取到C:\GTK
似乎是最顺利的,否则您将追逐丢失的头文件。