$ npm install sharp
> [email protected] install /Users/onetom/XXX/node_modules/sharp
> node-gyp rebuild
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libxml-2.0', required by 'vips', not found
gyp: Call to 'PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" pkg-config --libs vips' returned exit status 1. 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.10.21/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.1.0
gyp ERR! command "node" "/usr/local/Cellar/node/0.10.21/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/onetom/XXX/node_modules/sharp
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 had a similar issue with the node-vips library, which I've ended up fixing like this:
↪ cat node_modules/vips/binding.gyp
{
'targets': [{
'target_name': 'vips',
'sources': [
'src/node-vips.cc',
'src/transform.cc'
],
'conditions': [
['OS=="mac"', {
'libraries': [
'<!@(PKG_CONFIG_PATH=/usr/local/Library/ENV/pkgconfig/10.8 pkg-config --libs glib-2.0 vips exiv2)',
],
'include_dirs': [
'/usr/local/include/glib-2.0',
'/usr/local/include/vips',
'/usr/local/include/exiv2',
'/usr/local/lib/glib-2.0/include'
]
}, {
'libraries': [
'<!@(PKG_CONFIG_PATH="/usr/lib/pkgconfig" pkg-config --libs glib-2.0 vips exiv2)'
],
'include_dirs': [
'/usr/include/glib-2.0',
'/usr/lib/glib-2.0/include',
'/usr/lib/x86_64-linux-gnu/glib-2.0/include'
],
}]
],
'cflags': [ '-fexceptions' ],
'cflags_cc': [ '-fexceptions' ]
}]
}
I'm very curious how could it compile without tweaks on others' systems.
brew install homebrew/science/vips
alone is clearly not enough.