brianc / node-pg-native

Native (C/C++) bindings to PostgreSQL with sync and async options.
247 stars 44 forks source link

Doesn't work with Node.js 9.x #66

Closed vitaly-t closed 6 years ago

vitaly-t commented 6 years ago

...outputs:

node_modules\libpq>if not defined npm_config_node_gyp (node "C:\Users\Name\AppData\Roaming\nvm\v9.4.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.
js" rebuild )  else (node "C:\Users\Name\AppData\Roaming\nvm\v9.4.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
'pg_config' is not recognized as an internal or external command,
operable program or batch file.
gyp: Call to 'pg_config --libdir' returned exit status 1 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 (C:\Users\Name\AppData\Roaming\nvm\v9.4.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:160:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Name\\AppData\\Roaming\\nvm\\v9.4.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\NodeJS\project\node_modules\libpq
gyp ERR! node -v v9.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! libpq@1.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libpq@1.8.7 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!     C:\Users\Vitaly\AppData\Roaming\npm-cache\_logs\2018-01-19T08_41_16_286Z-debug.log

Tested on Windows 10 64-bit, Node.js 9.4

Note that node-postgres in the same configuration installs and works without issues.

vitaly-t commented 6 years ago

Ops, sorry, looks like my local c++ compiler got broken.

pflugs30 commented 6 years ago

@vitaly-t I'm having the same issue. I already ran npm install --global --production windows-build-tools, and I still get the same error. Can you please tell me more about how you fixed it? Thanks!

pflugs30 commented 6 years ago

@vitaly-t belay that request. I got it to work.

Here's what I did:

  1. Install Windows build tools using this command from a prompt with Admin privileges: npm install --global --production windows-build-tools.
  2. Ensure my system had all the node-pg-native requirements specified here.
  3. Re-ran npm install. Everything worked after that!