Node-postgres: Unable to install pg /bin/sh: 1: pg_config: not found

Created on 14 Nov 2013  ·  5Comments  ·  Source: brianc/node-postgres

[email protected] install /home/xxx/node/node_modules/pg
node-gyp rebuild || (exit 0)

/bin/sh: 1: pg_config: 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/share/node-gyp/lib/configure.js:431: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 Linux 3.11.0-12-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/rkot/node/node_modules/pg
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
[email protected] node_modules/pg
├── [email protected]
└── [email protected] ([email protected], [email protected])

nodejs -v
v0.10.15
npm -v
1.2.18

Any idea how to fix it?

Most helpful comment

Does anyone know what's the fix for mac users? (What's the mac equivalent for apt-get install libpq-dev?)

All 5 comments

Do you have the dependencies installed for the c-binding?

https://github.com/brianc/node-postgres/wiki/Installation

Yes:

sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
build-essential set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

Ok after installing sudo apt-get install libpq-dev its working now :) Thanks!

Does anyone know what's the fix for mac users? (What's the mac equivalent for apt-get install libpq-dev?)

Hey @harrison0723 this worked for me:
brew install postgresql

https://superuser.com/questions/296873/install-libpq-dev-on-mac-os

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gpanainte picture gpanainte  ·  3Comments

chrisjensen picture chrisjensen  ·  4Comments

joaquimknox picture joaquimknox  ·  3Comments

AhmedBHameed picture AhmedBHameed  ·  3Comments

gajus picture gajus  ·  4Comments