[英]Node.js install canvas failed on mac osx 10.8.4 : src/Canvas.h…fatal error: v8.h file not found
I install nodejs following nodejs wiki, it's going well, and then install node canvas following this way https://github.com/LearnBoost/node-canvas/wiki/Installation---OSX , the steps before "$ npm install canvas" were going well, but the final step "$ npm install canvas" was failed again and again, I have tried install the Nodejs both building and installing, and i also try "sudo", and I have try "$ export PKG_CONFIG_PATH=.....", but still can't install canvas, I'm sure I have followed all the guide clarely.我按照nodejs wiki安装nodejs,一切顺利,然后按照这种方式安装node canvas https://github.com/LearnBoost/node-canvas/wiki/Installation---OSX,“$ npm install canvas”之前的步骤进展顺利,但最后一步“$ npm install canvas”一次又一次失败,我尝试安装Nodejs,包括构建和安装,我也尝试过“sudo”,我尝试过“$ export PKG_CONFIG_PATH=.. ...”,但仍然无法安装画布,我确定我已经清楚地遵循了所有指南。 Below is the log:
下面是日志:
SLMacs-MacBook-Pro-2:~ percy$ npm install canvas
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas
> canvas@1.0.3 install /Users/macbookpro/node_modules/canvas
> node-gyp rebuild
CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.cc:7:
../src/Canvas.h:11:10: fatal error: 'v8.h' file not found
#include <v8.h>
^
1 error generated.
make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:96:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Darwin 12.4.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/macbookpro/node_modules/canvas
gyp ERR! node -v v0.8.12
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
npm ERR! canvas@1.0.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the canvas@1.0.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 12.4.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! cwd /Users/macbookpro
npm ERR! node -v v0.8.12
npm ERR! npm -v 1.1.63
npm ERR! code ELIFECYCLE
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR! { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.4.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! cwd /Users/macbookpro
npm ERR! node -v v0.8.12
npm ERR! npm -v 1.1.63
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/macbookpro/npm-debug.log
npm ERR! not ok code 0
To fix it:要解决这个问题:
Then run 'npm install canvas' again.然后再次运行“npm install canvas”。
I have no idea why the MacOS node package(just for v0.10.13) is missing these things.我不知道为什么 MacOS 节点包(仅适用于 v0.10.13)缺少这些东西。
I just ran into this problem myself.我自己刚刚遇到了这个问题。 You may need to install some dependencies.
您可能需要安装一些依赖项。 Try running the following command in terminal.
尝试在终端中运行以下命令。
brew install pkg-config cairo pango libpng jpeg giflib librsvg
Afterwards, rerun npm install.之后,重新运行 npm install。 This worked for me.
这对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.