我是一名对命令行工作比较新的人。我正在使用gulp设置一个项目,并已成功安装gulp并编译sass文件。然而,我无法通过以下方式安装canvas:
$ npm install canvas
我需要安装canvas,因为css-sprite运行需要它。我遇到了以下错误。我已经安装了cairo、quartz和homebrew。我查看了其他问题单并尝试运行
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
,然后重新安装,但没有成功,也不知道还能做什么来解决问题。以下是错误信息...
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan
canvas@1.1.3 install /usr/local/lib/node_modules/canvas
node-gyp rebuild
./util/has_cairo_freetype.sh: line 4: pkg-config: command not found
gyp: Call to './util/has_cairo_freetype.sh' returned exit status 0.
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 13.1.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/canvas
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! canvas@1.1.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@1.1.3 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 Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "canvas"
npm ERR! cwd /Users/kylebebeau/websites/ls/code/templates/ls3
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/kylebebeau/websites/ls/code/templates/ls3/npm-debug.log
npm ERR! not ok code 0
非常感谢您的帮助和指导。