mac下npm install canvas报错,高手请看
发布于 11 年前 作者 gws321 12653 次浏览 最后一次编辑是 8 年前

mac下npm install canvas报错,高手请看

npm install canvas 
npm WARN package.json crypto[@0](/user/0).0.3 crypto is also the name of a node core module.
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](/user/1).1.3 install /Volumes/macFile/nodeProject/cngouwo/node_modules/canvas
> node-gyp rebuild

Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' 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:107:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit     (child_process.js:879:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-    gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Volumes/macFile/nodeProject/cngouwo/node_modules/canvas
gyp ERR! node -v v0.11.11
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! canvas[@1](/user/1).1.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas[@1](/user/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.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! cwd /Volumes/macFile/nodeProject/cngouwo
npm ERR! node -v v0.11.11
npm ERR! npm -v 1.3.25
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Volumes/macFile/nodeProject/cngouwo/npm-debug.log
npm ERR! not ok code 0
3 回复

救命啊谢谢啊!

请按照https://github.com/LearnBoost/node-canvas/wiki/Installation—OSX 一步步做

要装 cairo 和其他的图像处理的库哟。。。安装那些库的时候注意一下权限问题

回到顶部