2

为什么要安装 Cairo 以使用 Canvas/ChartJS?我正在使用 OSX / Mac。我遇到了为 Charts 安装这个项目的问题。我见过一些 stackoverflow 线程,解决方法是安装 Cairo 的系统级库。

https://github.com/jerairrest/react-chartjs-2

> canvas@1.6.7 install /Users/rjain/code/react-chartjs-2/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_lib.sh freetype' returned exit status 0 while in binding.gyp. 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 (/Users/rjain/.config/fnm/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 17.0.0
gyp ERR! command "/Users/rjain/.config/fnm/bin/node" "/Users/rjain/.config/fnm/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/rjain/code/react-chartjs-2/node_modules/canvas
gyp ERR! node -v v8.6.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN react-chartjs-2@2.6.4 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@1.6.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@1.6.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/rjain/.npm/_logs/2017-10-11T21_53_41_819Z-debug.log
4

0 回答 0