question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm install pg fails when Postgres isn't installed: /bin/sh: pg_config: command not found

See original GitHub issue
$ npm install pg
/
> pg@3.6.3 install /private/tmp/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. 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:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /private/tmp/node_modules/pg
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
pg@3.6.3 node_modules/pg
├── packet-reader@0.2.0
├── bindings@1.2.1
├── pg-connection-string@0.1.3
├── buffer-writer@1.0.0
├── generic-pool@2.1.1
├── pg-types@1.6.0
├── nan@1.3.0
└── pgpass@0.0.3 (split@0.3.1)

I recently rebuilt my dev environment, and don’t have postgres installed yet, which is what I suspect this error is about. It might seem obvious, but it would be nice to call that out in your docs early on. Many modules end up requiring pg as a dep deep in their dependency chain, and users may not understand they need postgres in order to make this work.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
davisfordcommented, Mar 27, 2015

Does anyone know if there is a postgres lib package that we can install to get past this? I’d like to use the native bindings, and I’m trying to create a Docker image – I’d prefer not to require to have full-blown postgres in the image just to get past the compilation of the driver.

Edit: seems this can be resolved on Debian flavor via apt-get install libpq-dev

0reactions
brianccommented, Nov 20, 2014

yay! thank you! 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation of NPM package fails with unrelated package error
1 Answer 1 · Even if I remove ./node_modules and run npm install the problem still occurs. – prmph · Yes, you are...
Read more >
pg-native - npm
You need PostgreSQL client libraries & tools installed. An easy way to check is to type pg_config . If pg_config is in your...
Read more >
serverless/serverless - Gitter
npm i --save pg-native npm WARN package.json schedule-service@0.0.1 No license field ... node-gyp rebuild /bin/sh: pg_config: command not found gyp: Call to ...
Read more >
Error: pg_config executable not found | How to fix - Bobcares
Error : pg_config executable not found? Firstly, you need to install libpq-dev and python-dev ( python-dev is optional ).
Read more >
gitlab-development-kit - doc - troubleshooting.md
After installing PostgreSQL with brew you will have to set the proper ... Error in database migrations when pg_trgm extension is missing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found