I'm trying to install the pg-native
package:
sudo npm install pg-native
but the following error is generated:
> [email protected] install /Workspace/auth/node_modules/libpq
> node-gyp rebuild
/bin/sh: pg_config: command not found
gyp: Call to 'pg_config --libdir' returned exit status 127. 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:355:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/usr/local/Cellar/node/4.1.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Workspace/auth/node_modules/libpq
gyp ERR! node -v v4.1.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:libpq [email protected] install: `node-gyp rebuild`
npm WARN install:libpq Exit status 1
I've tried remedying this by installing the node-gyp
module and then running the rebuild command manually:
sudo npm install -g node-gyp
sudo node-gyp rebuild
I read that this issue no longer persists in more current versions of Node, so I updated to version v4.1.1
.
I've also tried a mix of installing the modules locally to the workspace and globally to the rest of the machine, but still no luck. Running node-gyp
works, so it looks like that has been properly installed.
Any help on this issue would be greatly appreciated!
Not sure why I didn't think of this originally, but this was resolved by installing libpq
on my local machine.
brew install postgresql
This bundle comes with libpq
, which I didn't realize was needed at first, given the ambiguity in the error message.
It looked like it was either installed, or installing as a prerequisite since the first line in the error message identified a version number for this package, [email protected]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With