在pkg-configsearchpath中未find软件包cairo。 节点js安装canvas问题

我有一个问题在节点安装canvas模块安装。它似乎是与开罗的东西我得到这个错误…

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 /Users/plimb/Desktop/motion-therapy/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. 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/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:424:16) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789: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 /Users/plimb/Desktop/motion-therapy/node_modules/canvas gyp ERR! node -v v0.10.21 gyp ERR! node-gyp -v v0.10.10 gyp ERR! not ok npm ERR! weird error 1 npm ERR! not ok code 0 I'm not sure what it all means! Would appreciate any help!For example how to a mkdir cairo pc in the pkg_config_path environment variable? 

有同样的问题和@ Epistemex的链接帮助我排除故障。

…您需要安装libcairo2-devlibjpeg-devlibgif-dev软件包…

 sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev 

我也在Mac上面临同样的问题,所以我已经尝试了这些步骤,我得到的解决scheme

Mac OSX Version> = 10.7.5 node -v = v0.8.12

 $ brew install cairo $ pkg-config --atleast-version=1.12.2 cairo $ echo $? 

如果它返回1,则需要设置PKG_CONFIG_PATH环境variables,以便可以findcairo.pc和fontconfig.pc

 $ locate cairo.pc $ export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig/ 

再次运行pkg-config …

 $ pkg-config --atleast-version=1.12.2 cairo $ echo $? 

如果它返回0,那么一切都很好。

 $ npm install canvas 

在安装qrcode包的同时,在OS X 10.11.2上也遇到同样的问题。

解决安装这些:

 brew install cairo brew install pkg-config xcode-select --install 

如果有人仍然有这个问题,发现这个网页,下面的CentOS 6.6的作品:

 sudo yum install cairo cairo-devel 

基本上,解决scheme是你需要安装开发包和常规软件包(这里最好的答案是做同样的事情 – 除了Ubuntu – 每个发行版可以不同)。

我只需要在OSX 10.10.4上安装pkg-config

brew install pkg-config

    Interesting Posts