code

pkg-config 검색 경로에서 패키지 cairo를 찾을 수 없습니다.

codestyles 2020. 9. 11. 08:01
반응형

pkg-config 검색 경로에서 패키지 cairo를 찾을 수 없습니다. Node JS 설치 캔버스 문제


노드에 캔버스 모듈을 설치하는 데 문제가 있습니다. 카이로에 문제가있는 것 같습니다.이 오류가 발생합니다.

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

그게 무슨 뜻인지 모르겠어요! 도움을 주시면 감사하겠습니다! 예를 들어 pkg_config_path 환경 변수에서 mkdir cairo pc를 사용하는 방법은 무엇입니까?


같은 문제가 있었고 @Epistemex의 링크 가 문제를 해결하는 데 도움이되었습니다.

... 당신은 설치해야 할 libcairo2-dev, libjpeg-dev그리고 libgif-dev패키지 ...

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

나는 또한 Mac에서 동일한 문제에 직면 했으므로이 단계를 시도했으며 해결책을 얻었습니다.

Mac OSX 버전> = 10.7.5 노드 -v = v0.8.12

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

1이 반환되면 cairo.pc 및 fontconfig.pc를 찾을 수 있도록 PKG_CONFIG_PATH 환경 변수를 설정해야합니다.

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

pkg-config 다시 실행 중 ...

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

$ echo $?

If it returns a 0 then all is well in the hood.

$ npm install canvas

Had the same problem on OS X 10.11.2 while installing qrcode package.

Solved by installing these ones:

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

If anyone is still having this problem and found this page, the following works for CentOS 6.6:

sudo yum install cairo cairo-devel

Basically the solution is you need to install the development package as well as the regular package (the best answer here does the same thing - except is for Ubuntu - every distro can be different).


I followed the steps given by @Piyush. But I needed an extra step to make it work. I'm using OS X 10.14.5

So this is what I followed.

brew install pkg-config
brew install cairo
pkg-config --atleast-version=1.12.2 cairo
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig/
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig"
npm install canvas


I just needed to install pkg-config on OSX 10.10.4

brew install pkg-config


When I ran into this problem the issue was that the version of pkg-config on my path was the version supplied by chefdk instead of the homebrew installed version.

$ which pkg-config
/usr/local/bin/pkg-config

$ eval "$(chef shell-init bash)"
$ which pkg-config
/opt/chefdk/embedded/bin/pkg-config

The solution was to remove the eval "$(chef shell-init bash)" entry from my bash profile.

More discussion of the issue in chefdk's path generation on Github https://github.com/chef/chef-dk/issues/313


The accepted answer is just fine if you use apt-get. For YUM/DNF users (Fedora, CentOS, other RHEL-like systems), use the following

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

참고URL : https://stackoverflow.com/questions/22100213/package-cairo-was-not-found-in-the-pkg-config-search-path-node-j-s-install-canv

반응형