brianc/node-pg-native

Doesn't work with Node.js 9.x

Closed this issue · 3 comments

...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.

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

@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!

@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!