Node-postgres: node-gyp rebuild error

Created on 3 Nov 2013  ·  8Comments  ·  Source: brianc/node-postgres

I'm not sure if this is an issue with binding.gyp or if it's an issue with node-gyp, but here are the results of installing pg.

$ npm install pg --save
npm http GET https://registry.npmjs.org/pg
npm http 304 https://registry.npmjs.org/pg
npm http GET https://registry.npmjs.org/generic-pool/2.0.3
npm http GET https://registry.npmjs.org/buffer-writer/1.0.0
npm http 304 https://registry.npmjs.org/generic-pool/2.0.3
npm http 304 https://registry.npmjs.org/buffer-writer/1.0.0
npm http GET https://registry.npmjs.org/cloned/0.0.1
npm http GET https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/cloned/0.0.1
npm http 304 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/rmdir
npm http 304 https://registry.npmjs.org/rmdir

> [email protected] install /home/username/node_projects/writer/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/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 Linux 3.8.0-19-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/username/node_projects/writer/node_modules/pg
gyp ERR! node -v v0.10.20
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
[email protected] node_modules/pg
├── [email protected]
└── [email protected] ([email protected], [email protected])

Most helpful comment

Ran into this problem on OSX (10.11). The solution was to

brew install postgresql

creds to http://stackoverflow.com/questions/32948935/gyp-failing-when-installing-pg-native
AND

export PATH=/Library/PostgreSQL/9.3/bin:$PATH

creds to http://stackoverflow.com/questions/21713680/can-not-install-node-postgres

I definitely think this would be worth adding to the docs

All 8 comments

Is the pg_config binary in the PATH? Did you install the required dependencies for the c binding?

Found the dependencies. Closing this issue, though I think that listing the requirements for building the c binding in the documentation would be incredibly beneficial.

Would love to merge your pull request ;)

@zanothis I appreciate the update to the wiki. Thanks! :+1:

@brianc and @zanothis - I see the comment in the wiki on using the pure JS version, so that has unblocked me. But I don't see the information on building the c binding. If it's not in there, I can add it -- but I would need some schooling first

You're right, it would be good to have documentation on building the C bindings. What steps did you take to get it to install? It's platform specific, and I usually just bang on things until it works so if I could get what steps you took it'd help me w/ docs. :smile:

Hey @brianc I didn't actually get the C bindings to work (Ubuntu server) - I was hoping you could shed some light and I would could do the dredge work of documenting. Instead I wound up using pure JS - which is totally fine for the time-being.

Ran into this problem on OSX (10.11). The solution was to

brew install postgresql

creds to http://stackoverflow.com/questions/32948935/gyp-failing-when-installing-pg-native
AND

export PATH=/Library/PostgreSQL/9.3/bin:$PATH

creds to http://stackoverflow.com/questions/21713680/can-not-install-node-postgres

I definitely think this would be worth adding to the docs

Was this page helpful?
0 / 5 - 0 ratings