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.

node-gyp rebuild error

See original GitHub issue

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

> pg@2.8.2 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 
pg@2.8.2 node_modules/pg
├── generic-pool@2.0.3
└── buffer-writer@1.0.0 (async@0.2.9, cloned@0.0.1)

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ndey96commented, Sep 18, 2016

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

0reactions
morefromalancommented, May 27, 2014

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

trying to 'npm install', getting node-gyp rebuild errors #809
Follow these steps to resolve the issue. 1: Make sure you have build-tools installed. ... 3: Delete package-lock.json and node modules folder and ......
Read more >
Node 10 - `node-gyp rebuild` error during npm install
Resolved the issue by updating npm to latest version & running npm rebuild.
Read more >
Npm install command failing with message "could not find ...
When I run the npm install command, npm starts downloading the dependencies. But then, suddenly, it stops with the error: npm ERR! code...
Read more >
npm build error "node-gyp rebuild" error (#2768) - GitLab
gyp : Call to 'node -p "require('node-addon-api').include"' returned exit status 0 while in binding.gyp. while trying to load binding.gyp gyp ...
Read more >
How to Handle Node-Gyp Rebuild Failing on Mac
How to Solve the Node-gyp Rebuild Error · Restart your computer to get rid of any temporary bugs that might be affecting your...
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