Package cairo was not found in the pkg-config search path. Node j.s install canvas issue

后端 未结 9 704
逝去的感伤
逝去的感伤 2020-12-01 05:46

I am having a problem installing installing the canvas module in node..It seems to be something with cairo I am getting this error...

npm http GET https://re         


        
相关标签:
9条回答
  • 2020-12-01 06:20

    Had the same problem and @Epistemex's link helped me troubleshoot it.

    ... You need to install libcairo2-dev, libjpeg-dev and libgif-dev packages ...

    sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev
    
    0 讨论(0)
  • 2020-12-01 06:24

    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

    0 讨论(0)
  • 2020-12-01 06:31

    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
    
    0 讨论(0)
  • 2020-12-01 06:32

    I was also facing same issue on mac so I have tried these steps & I got solution

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

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

    If it returns a 1 you will need to set the PKG_CONFIG_PATH environment variable so cairo.pc and fontconfig.pc can be found

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

    Running pkg-config again ...

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

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

    $ npm install canvas
    
    0 讨论(0)
  • 2020-12-01 06:38

    I just needed to install pkg-config on OSX 10.10.4

    brew install pkg-config

    0 讨论(0)
  • 2020-12-01 06:38

    For Ubuntu, these're the commands. Also, here's the reference.

    $ sudo apt-get update 
    $ sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev 
    
    0 讨论(0)
提交回复
热议问题