brianc / node-libpq

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

Install failing with node 8.0.0 #59

Closed travega closed 6 years ago

travega commented 6 years ago

I seem to be unable to install libpq@1.8.7 with Node 8.0.0. I have node-gyp@3.6.2 and nan@2.9.1 already installed but I get the following any time try to install libpq@1.8.7

I'm running Postgres 10.2 via homebrew on MacOS 10.13.3

$> npm install libpq                                                                     

> libpq@1.8.7 install /Users/<username>/src/nibs/node_modules/libpq
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  CXX(target) Release/obj.target/addon/src/connection.o
In file included from ../src/connection.cc:1:
In file included from ../src/addon.h:4:
../../nan/nan.h:1359:11: error: no type named 'async_context' in namespace 'node'
    node::async_context context;
    ~~~~~~^
../../nan/nan.h:1290:60: error: too few arguments to function call, expected 4, have 3
      context = node::EmitAsyncInit(isolate, resource, name);
                ~~~~~~~~~~~~~~~~~~~                        ^
/Users/<username>/.node-gyp/8.0.0/include/node/node.h:543:13: note: 'EmitAsyncInit' declared here
NODE_EXTERN async_uid EmitAsyncInit(v8::Isolate* isolate,
            ^
In file included from ../src/connection.cc:1:
In file included from ../src/addon.h:4:
../../nan/nan.h:1306:67: error: too few arguments to function call, expected 4, have 3
      context = node::EmitAsyncInit(isolate, resource, name_string);
                ~~~~~~~~~~~~~~~~~~~                               ^
/Users/<username>/.node-gyp/8.0.0/include/node/node.h:543:13: note: 'EmitAsyncInit' declared here
NODE_EXTERN async_uid EmitAsyncInit(v8::Isolate* isolate,
            ^
In file included from ../src/connection.cc:1:
In file included from ../src/addon.h:4:
../../nan/nan.h:1359:25: warning: private field 'context' is not used [-Wunused-private-field]
    node::async_context context;
                        ^
1 warning and 3 errors generated.
make: *** [Release/obj.target/addon/src/connection.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/<username>/.nvm/versions/node/v8.0.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/Users/<username>/.nvm/versions/node/v8.0.0/bin/node" "/Users/<username>/.nvm/versions/node/v8.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/<username>/src/nibs/node_modules/libpq
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN loyalty@0.0.0 No license field.

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.

Any suggestions here? Thanks :)

travega commented 6 years ago

I solved the issue for now by installing libpq separately via homebrew: brew install libpq. While I get a message saying that libpq may conflict with Postgres 10.2 it doesn't actually cause any issues with the version installed by Postgres. So, will serve as a workaround for now.