Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package fontconfig was not found in the pkg-config search path #246

Closed
Qard opened this issue Jan 16, 2013 · 18 comments
Closed

Package fontconfig was not found in the pkg-config search path #246

Qard opened this issue Jan 16, 2013 · 18 comments

Comments

@Qard
Copy link

Qard commented Jan 16, 2013

Just tried installing canvas 1.0.0 from npm and I'm getting this error;

> canvas@1.0.0 install /Users/stephenbelanger/Documents/Work/BlackcombGames/stats/node/node_modules/canvas
> node-gyp rebuild

Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
Package 'fontconfig', required by 'cairo', not found
Traceback (most recent call last):
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/gyp", line 18, in <module>
    sys.exit(gyp.main(sys.argv[1:]))
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/__init__.py", line 511, in main
    return gyp_main(args)
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/__init__.py", line 494, in gyp_main
    options.circular_check)
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/__init__.py", line 133, in Load
    depth, generator_input_info, check, circular_check)
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/input.py", line 2378, in Load
    depth, check)
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/input.py", line 384, in LoadTargetBuildFile
    build_file_data, PHASE_EARLY, variables, build_file_path)
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/input.py", line 1027, in ProcessVariablesAndConditionsInDict
    ProcessConditionsInDict(the_dict, phase, variables, build_file)
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/input.py", line 904, in ProcessConditionsInDict
    variables, build_file)
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/input.py", line 975, in ProcessVariablesAndConditionsInDict
    variables, build_file, 'variables')
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/input.py", line 982, in ProcessVariablesAndConditionsInDict
    expanded = ExpandVariables(value, phase, variables, build_file)
  File "/Users/stephenbelanger/.node-gyp/0.8.15/tools/gyp/pylib/gyp/input.py", line 714, in ExpandVariables
    (contents, p.returncode))
Exception: 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/Cellar/node/0.8.15/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:350:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "node" "/usr/local/Cellar/node/0.8.15/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/stephenbelanger/Documents/Work/BlackcombGames/stats/node/node_modules/canvas
gyp ERR! node -v v0.8.15
gyp ERR! node-gyp -v v0.7.1
gyp ERR! not ok 
npm ERR! canvas@1.0.0 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the canvas@1.0.0 install script.
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! System Darwin 11.4.2
npm ERR! command "/usr/local/Cellar/node/0.8.15/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/stephenbelanger/Documents/Work/BlackcombGames/stats/node
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/stephenbelanger/Documents/Work/BlackcombGames/stats/node/npm-debug.log
npm ERR! not ok code 0
@codeincontext
Copy link

Have you tried export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig? I had to specify that after installing Cairo via homebrew

@aom
Copy link

aom commented Mar 26, 2013

@skattyadz This worked for me but I ran into other problems described in #267.

@RobertWHurst
Copy link

I also have this issue, any chance this will get fixed? Brew is rather popular and its directories should be checked for dependencies.

@nbppp2
Copy link

nbppp2 commented Jun 7, 2013

Depending on how you installed X11 depends on the export you need to add. If you are using OSX's built in X11, or installed XQuartz use 'export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig' if you installed using hombrew or some other package manager use 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig'.

More info on that can be found here https://github.com/LearnBoost/node-canvas/wiki/Installation---OSX

Hope that helps.

@JohnMcLear
Copy link

Hrm this issue is blocking me installing on smartOS (joyents OS)

[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# npm install
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas

> canvas@1.0.3 install /home/draw/node_modules/canvas
> node-gyp rebuild

./util/has_cairo_freetype.sh: line 4: pkg-config: command not 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 (/opt/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:415:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System SunOS 5.11
gyp ERR! command "node" "/opt/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/draw/node_modules/canvas
gyp ERR! node -v v0.10.5
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
npm ERR! canvas@1.0.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the canvas@1.0.3 install script.
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! System SunOS 5.11
npm ERR! command "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! cwd /home/draw
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/draw/npm-debug.log
npm ERR! not ok code 0

[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# locate pkg-config
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]#

[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# pkgin search pkg-config
verifypc-1.6         Sanity check package dependencies according to pkg-config
pkg-config-0.28      System for managing library compile/link flags

=: package is installed and up-to-date
<: package is installed but newer version is available
>: installed package has a greater version than available package
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# pkgin install pkg-config-0.28
calculating dependencies... done.

nothing to upgrade.
1 packages to be installed: pkg-config-0.28 (215K to download, 558K to install)

proceed ? [Y/n]
downloading packages...
pkg-config-0.28.tgz                                                                                                                                                                              100%  215KB 215.1KB/s 215.1KB/s   00:00
installing packages...
installing pkg-config-0.28...
pkg_install warnings: 0, errors: 0
reading local summary...
processing local summary...
updating database: 100%
marking pkg-config-0.28 as non auto-removable
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# npm install
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas

> canvas@1.0.3 install /home/draw/node_modules/canvas
> node-gyp rebuild

Package xproto was not found in the pkg-config search path.
Perhaps you should add the directory containing `xproto.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xproto', required by 'xau', not 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 (/opt/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:415:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System SunOS 5.11
gyp ERR! command "node" "/opt/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/draw/node_modules/canvas
gyp ERR! node -v v0.10.5
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
npm ERR! canvas@1.0.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the canvas@1.0.3 install script.
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! System SunOS 5.11
npm ERR! command "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! cwd /home/draw
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/draw/npm-debug.log
npm ERR! not ok code 0

[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# locate xproto.pc
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]#

[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# pkgin search xproto
xproto-7.0.23nb2     X protocol and ancillary headers from Xorg X11

=: package is installed and up-to-date
<: package is installed but newer version is available
>: installed package has a greater version than available package
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# pkgin install xproto
calculating dependencies... done.

nothing to upgrade.
1 packages to be installed: xproto-7.0.23nb2 (188K to download, 1160K to install)

proceed ? [Y/n]
downloading packages...
xproto-7.0.23nb2.tgz                                                                                                                                                                             100%  188KB 188.4KB/s 188.4KB/s   00:00
installing packages...
installing xproto-7.0.23nb2...
pkg_install warnings: 0, errors: 0
reading local summary...
processing local summary...
updating database: 100%
marking xproto-7.0.23nb2 as non auto-removable
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# locate xproto.pc
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# updatedb
/opt/local/bin/gfind: /system/lxproc/93550/fd/4: No such file or directory
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# locate xproto.pc
/opt/local/lib/pkgconfig/xproto.pc
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]# npm install
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas

> canvas@1.0.3 install /home/draw/node_modules/canvas
> node-gyp rebuild

Package renderproto was not found in the pkg-config search path.
Perhaps you should add the directory containing `renderproto.pc'
to the PKG_CONFIG_PATH environment variable
Package 'renderproto', required by 'xrender', not 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 (/opt/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:415:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System SunOS 5.11
gyp ERR! command "node" "/opt/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/draw/node_modules/canvas
gyp ERR! node -v v0.10.5
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
npm ERR! canvas@1.0.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the canvas@1.0.3 install script.
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! System SunOS 5.11
npm ERR! command "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! cwd /home/draw
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/draw/npm-debug.log
npm ERR! not ok code 0
[root@c5da04ca-3754-4831-9a74-8e11f9b1d9bc /home/draw]#


Any more suggestions?

@JohnMcLear
Copy link

Okay so I solved this for SmartOS, see my command history..

pkgin install gcc47-4.7.2nb3 gcc-compiler gcc47 gmake fontconfig-2.10.91nb1 xproto renderproto kbproto xextproto
pkg-config cairo --cflags-only-I
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
npm install

To find your correct PKG_CONFIG_PATH do a locate xproto.pc and use that path (minus the file name)

@johnfelipe
Copy link

and in ubuntu?

@rchekaluk
Copy link

/usr/share/pkgconfig/xproto.pc on Ubuntu Trusty

@dt1973
Copy link

dt1973 commented Jan 18, 2015

Having the same problem on FreeBSD 10.1. cairo-1.12.18_1,2 is installed. I've tried export PKG_CONFIG_PATH=/usr/local/libdata/pkgconfig to no avail:

# uname -a
FreeBSD test 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014
# npm install canvas
/
> canvas@1.1.6 install /usr/home/www/myapp/node_modules/canvas
> node-gyp rebuild

./util/has_cairo_freetype.sh: line 4: pkg-config: command not 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: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 FreeBSD 10.1-RELEASE
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/home/www/myapp/node_modules/canvas
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! FreeBSD 10.1-RELEASE
npm ERR! argv "node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! node v0.10.35
npm ERR! npm  v2.1.18
npm ERR! code ELIFECYCLE

npm ERR! canvas@1.1.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@1.1.6 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!     /usr/home/www/myapp/npm-debug.log

@mltucker
Copy link
Contributor

@dt1973 looks like pkg-config executable is not in your PATH?

@dt1973
Copy link

dt1973 commented Jan 18, 2015

Indeed. Turns out I had to do pkg install pkgconf.

Thanks!

@LinusU
Copy link
Collaborator

LinusU commented Feb 15, 2016

Closing this since it's an old thread, please see our new installation instructions and report back if you still have problems...

@LinusU LinusU closed this as completed Feb 15, 2016
@hasnainshafqatmlt
Copy link

seems like it's worked, waoO

PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ npm install canvas

@maple-leaf
Copy link

Add a note for installing for mac on macOS 10.13.2 using brew:

  1. brew install pkg-config cairo libpng jpeg giflib fontconfig
  2. export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  3. so far, fontconfig.pc and libpng.pc may not exist on PKG_CONFIG_PATH, so you need copy them into PKG_CONFIG_PATH
cp /usr/local/Cellar/libpng/1.6.34/lib/pkgconfig/libpng.pc /usr/local/lib/pkgconfig
cp /usr/local/Cellar/libpng/1.6.34/lib/pkgconfig /usr/local/lib/pkgconfig
  1. now you should install node-canvas without any deps problem

@tomasdev
Copy link

tomasdev commented Feb 3, 2018

brew install pkg-config cairo pango libpng jpeg giflib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PATH="/usr/local/opt/icu4c/bin:$PATH
export PATH="/usr/local/opt/icu4c/sbin:$PATH
cp /usr/local/Cellar/libpng/1.6.34/lib/pkgconfig/libpng.pc /usr/local/lib/pkgconfig
cp /usr/local/Cellar/fontconfig/2.12.6/lib/pkgconfig/fontconfig.pc /usr/local/lib/pkgconfig
npm i canvas

These are all the steps I had to do in my Mac, thanks @maple-leaf for 99% of that

@tigercosmos
Copy link

@toddwilkens works well

@halfbeep
Copy link

on ubuntu 18* try:-

sudo apt-get install libfontconfig-dev

@talgalili
Copy link

Using sudo apt install pkgconf on linux mint worked for me. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests