使用NPM安装节点画布不起作用

时间:2015-03-16 12:53:24

标签: node.js canvas centos

我正在尝试使用LAMP在CentOs 6上安装node-canvas。我已经安装并更新了最新的Node JS以及nmp。

当我运行命令时:npm install canvas我只是得到以下错误:

[root@localhost tmp]# sudo npm install canvas

> canvas@1.2.1 install /tmp/node_modules/canvas
> node-gyp rebuild

Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangocairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pangocairo' found
gyp: Call to 'pkg-config pangocairo --libs' 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 (/usr/lib/node_modules/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:820:12)
gyp ERR! System Linux 2.6.32-504.8.1.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/node_modules/canvas
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Linux 2.6.32-504.8.1.el6.x86_64
npm ERR! argv "node" "/usr/bin/npm" "install" "canvas"
npm ERR! node v0.10.36
npm ERR! npm  v2.7.1
npm ERR! code ELIFECYCLE

npm ERR! canvas@1.2.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@1.2.1 install script 'node-gyp rebuild'.
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! Please include the following file with any support request:
npm ERR!     /tmp/npm-debug.log

1 个答案:

答案 0 :(得分:0)

在安装节点画布之前,您需要安装cairo和其他一些库。

只需使用以下命令:

yum install -y cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel