Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to setup node-postgres for my project. However I keep getting these gyp errors when I try to install it. How can I get node-postgres to recognize that my pg_config is located in /Library/PostgreSQL/9.3/bin/pg_config. Because my favourite search engine results told me to do it like this:

➜  src git:(master) ✗ PG_CONFIG=/Library/PostgreSQL/9.3/bin/pg_config
➜  src git:(master) ✗ export PG_CONFIG
➜  src git:(master) ✗ sudo npm install pg
Password:
npm WARN package.json [email protected] No repository field.
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 GET https://registry.npmjs.org/pgpass/0.0.1
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/pgpass/0.0.1
npm http 304 https://registry.npmjs.org/buffer-writer/1.0.0
npm http 304 https://registry.npmjs.org/generic-pool/2.0.3
npm http GET https://registry.npmjs.org/split
npm http 304 https://registry.npmjs.org/split
npm http GET https://registry.npmjs.org/through
npm http 304 https://registry.npmjs.org/through

> [email protected] install /Users/me/test/src/node_modules/pg
> node-gyp rebuild || (exit 0)

/bin/sh: pg_config: command not found
gyp: Call to 'pg_config --libdir' returned exit status 127.
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:337: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.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/me/test/src/node_modules/pg
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
[email protected] node_modules/pg
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected] ([email protected])
➜  src git:(master) ✗
share|improve this question

closed as off-topic by Clodoaldo Neto, Trevor Senior, Milen A. Radev, Paul Mougel, Daniel Vérité Mar 4 '14 at 22:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on professional server- or networking-related infrastructure administration are off-topic for Stack Overflow unless they directly involve programming or programming tools. You may be able to get help on Server Fault." – Clodoaldo Neto, Trevor Senior, Milen A. Radev, Paul Mougel
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 8 down vote accepted

It looks like the node build tool doesn't look at the PG_CONFIG env var:

/bin/sh: pg_config: command not found

Add it to the PATH instead:

export PATH=/Library/PostgreSQL/9.3/bin:$PATH
share|improve this answer
    
Awesome you! it looks like I have to dig into these export paths some more; I just don't get their purpose –  Egidius Feb 12 '14 at 7:36
    
@Egidius If a command is on the path, you can run it without specifying a full path. So /bin/ls can be run as simply ls because /bin is on the PATH. This is used by toolchains, compile/configure scripts, etc, to discover the location of things that could be installed anywhere on the system. –  Craig Ringer Feb 13 '14 at 0:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.