brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
111 stars 41 forks source link

gyp: Call to 'pg_config --libdir' returned exit status 127 while in binding.gyp. while trying to load binding.gyp #74

Closed apunuj closed 4 years ago

apunuj commented 4 years ago

I am trying to install libpq with node js 13.9.0 on MacOS Majave (10.14). Getting this error trace:

Apoorvs-MacBook-Air:impact-node apoorv$ npm install --save libpq

> libpq@1.8.9 install /Users/apoorv/Documents/ProjectsWorkspace/impact-node/node_modules/libpq
> node-gyp rebuild

/bin/sh: pg_config: command not found
gyp: Call to 'pg_config --libdir' returned exit status 127 while in binding.gyp. 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 (/Users/apoorv/.nvm/versions/node/v13.9.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/apoorv/.nvm/versions/node/v13.9.0/bin/node" "/Users/apoorv/.nvm/versions/node/v13.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/apoorv/Documents/ProjectsWorkspace/impact-node/node_modules/libpq
gyp ERR! node -v v13.9.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok 
npm WARN eslint-plugin-jsx-a11y@2.2.3 requires a peer of eslint@^2.10.2 || 3.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react@6.10.3 requires a peer of eslint@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN rnd@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! libpq@1.8.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the libpq@1.8.9 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/apoorv/.npm/_logs/2020-02-25T07_13_01_711Z-debug.log
apunuj commented 4 years ago

Once I installed postgresql using brew, like so:

brew install postgresql

the module installed without error.

zeigo commented 3 years ago

The problem is /bin/sh: pg_config: command not found. As the readme says, the pg_config program should be in your path