node-libpq icon indicating copy to clipboard operation
node-libpq copied to clipboard

Build error with Node 6.0.0 and 6.1.0

Open Chris911 opened this issue 8 years ago • 9 comments

I'm running into issues when compiling libpq 1.8.2 (through pg-native 1.10.0) on both 6.0.0 and 6.1.0. Node 6 seems to be covered in your CI tests so I'm not sure why it's failing here. Here's the logs from npm-debug.log.

103498 info lifecycle [email protected]~install: [email protected]
103499 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle true
103500 verbose lifecycle [email protected]~install: PATH: /Users/chris/.nvm/versions/node/v6.1.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/chris/Documents/Development/Busbud/napi/node_modules/libpq/node_modules/.bin:/Users/chris/Documents/Development/Busbud/napi/node_modules/.bin:/Users/chris/.nvm/versions/node/v6.1.0/bin:/Users/chris/.nvm/versions/node/v6.1.0/bin:/Users/chris/google-cloud-sdk/bin:/Users/chris/go,/Users/chris/Documents/Development/Busbud/busbud-overseer/bin:/usr/local/heroku/bin:/Users/chris/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/opt/go/libexec/bin
103501 verbose lifecycle [email protected]~install: CWD: /Users/chris/Documents/Development/Busbud/napi/node_modules/libpq
103502 silly lifecycle [email protected]~install: Args: [ '-c', 'node-gyp rebuild' ]
103503 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
103504 info lifecycle [email protected]~install: Failed to exec install script
103505 verbose unlock done using /Users/chris/.npm/_locks/staging-5cb161093ea30bba.lock for /Users/chris/Documents/Development/Busbud/napi/node_modules/.staging
103506 silly rollbackFailedOptional Starting
103507 silly rollbackFailedOptional Finishing
103508 silly runTopLevelLifecycles Starting
103509 silly runTopLevelLifecycles Finishing
103510 silly install printInstalled
103511 warn [email protected] No repository field.
103512 warn [email protected] No license field.
103513 verbose stack Error: [email protected] install: `node-gyp rebuild`
103513 verbose stack Exit status 1
103513 verbose stack     at EventEmitter.<anonymous> (/Users/chris/.nvm/versions/node/v6.1.0/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
103513 verbose stack     at emitTwo (events.js:106:13)
103513 verbose stack     at EventEmitter.emit (events.js:191:7)
103513 verbose stack     at ChildProcess.<anonymous> (/Users/chris/.nvm/versions/node/v6.1.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
103513 verbose stack     at emitTwo (events.js:106:13)
103513 verbose stack     at ChildProcess.emit (events.js:191:7)
103513 verbose stack     at maybeClose (internal/child_process.js:850:16)
103513 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
103514 verbose pkgid [email protected]
103515 verbose cwd /Users/chris/Documents/Development/Busbud/napi
103516 error Darwin 15.0.0
103517 error argv "/Users/chris/.nvm/versions/node/v6.1.0/bin/node" "/Users/chris/.nvm/versions/node/v6.1.0/bin/npm" "i"
103518 error node v6.1.0
103519 error npm  v3.8.6
103520 error code ELIFECYCLE
103521 error [email protected] install: `node-gyp rebuild`
103521 error Exit status 1
103522 error Failed at the [email protected] install script 'node-gyp rebuild'.
103522 error Make sure you have the latest version of node.js and npm installed.
103522 error If you do, this is most likely a problem with the libpq package,
103522 error not with npm itself.
103522 error Tell the author that this fails on your system:
103522 error     node-gyp rebuild
103522 error You can get information on how to open an issue for this project with:
103522 error     npm bugs libpq
103522 error Or if that isn't available, you can get their info via:
103522 error     npm owner ls libpq
103522 error There is likely additional logging output above.
103523 verbose exit [ 1, true ]

This is on OS X running node 6.1.0 and npm 3.8.6.

Chris911 avatar May 07 '16 19:05 Chris911

This might help as well:

> [email protected] install /Users/chris/Documents/Development/Busbud/napi/node_modules/libpq
> node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
  CXX(target) Release/obj.target/addon/src/connection.o
../src/connection.cc:653:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete errBuff;
    ^
          []
../src/connection.cc:644:19: note: allocated with 'new[]' here
  char* errBuff = new char[255];
                  ^
../src/connection.cc:658:3: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
  delete errBuff;
  ^
        []
../src/connection.cc:644:19: note: allocated with 'new[]' here
  char* errBuff = new char[255];
                  ^
2 warnings generated.
/Users/chris/Documents/Development/Busbud/napi/node_modules/.bin/touch: line 1: syntax error near unexpected token `('
/Users/chris/Documents/Development/Busbud/napi/node_modules/.bin/touch: line 1: `var touch = require("../touch")'
make: *** [Release/obj.target/addon/src/connection.o] Error 2
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/chris/.nvm/versions/node/v6.1.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/Users/chris/.nvm/versions/node/v6.1.0/bin/node" "/Users/chris/.nvm/versions/node/v6.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/chris/Documents/Development/Busbud/napi/node_modules/libpq
gyp ERR! node -v v6.1.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 

Chris911 avatar May 07 '16 19:05 Chris911

Same here on Arch, node 6.1.0

make: Entering directory '/home/dev/project/node_modules/libpq/build'
  CXX(target) Release/obj.target/addon/src/connection.o
In file included from ../src/addon.h:4:0,
                 from ../src/connection.cc:1:
../node_modules/nan/nan.h:602:20: error: variable or field ‘AddGCEpilogueCallback’ declared void
       v8::Isolate::GCEpilogueCallback callback
                    ^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:602:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
       v8::Isolate::GCEpilogueCallback callback
       ^~
../node_modules/nan/nan.h:603:18: error: expected primary-expression before ‘gc_type_filter’
     , v8::GCType gc_type_filter = v8::kGCTypeAll) {
                  ^~~~~~~~~~~~~~
../node_modules/nan/nan.h:608:20: error: variable or field ‘RemoveGCEpilogueCallback’ declared void
       v8::Isolate::GCEpilogueCallback callback) {
                    ^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:608:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
       v8::Isolate::GCEpilogueCallback callback) {
       ^~
../node_modules/nan/nan.h:613:20: error: variable or field ‘AddGCPrologueCallback’ declared void
       v8::Isolate::GCPrologueCallback callback
                    ^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:613:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
       v8::Isolate::GCPrologueCallback callback
       ^~
../node_modules/nan/nan.h:614:18: error: expected primary-expression before ‘gc_type_filter’
     , v8::GCType gc_type_filter = v8::kGCTypeAll) {
                  ^~~~~~~~~~~~~~
../node_modules/nan/nan.h:619:20: error: variable or field ‘RemoveGCPrologueCallback’ declared void
       v8::Isolate::GCPrologueCallback callback) {
                    ^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:619:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
       v8::Isolate::GCPrologueCallback callback) {
       ^~
addon.target.mk:92: recipe for target 'Release/obj.target/addon/src/connection.o' failed
make: *** [Release/obj.target/addon/src/connection.o] Error 1

samdj avatar May 10 '16 05:05 samdj

Same in Ubuntu 12.04, node v6.2

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'libpq' ]
2 info using [email protected]
3 info using [email protected]
...
5158 warn In [email protected] replacing bundled version of node-gyp with [email protected]
5159 verbose stack Error: [email protected] install: `node-gyp rebuild`
5159 verbose stack Exit status 1
5159 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:245:16)
5159 verbose stack     at emitTwo (events.js:106:13)
5159 verbose stack     at EventEmitter.emit (events.js:191:7)
5159 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
5159 verbose stack     at emitTwo (events.js:106:13)
5159 verbose stack     at ChildProcess.emit (events.js:191:7)
5159 verbose stack     at maybeClose (internal/child_process.js:850:16)
5159 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
5160 verbose pkgid [email protected]
5161 verbose cwd /home/vagrant/task/server
5162 error Linux 3.2.0-23-generic-pae
5163 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "libpq"
5164 error node v6.2.0
5165 error npm  v3.9.0
5166 error code ELIFECYCLE
5167 error [email protected] install: `node-gyp rebuild`
5167 error Exit status 1
5168 error Failed at the [email protected] install script 'node-gyp rebuild'.
5168 error Make sure you have the latest version of node.js and npm installed.
5168 error If you do, this is most likely a problem with the libpq package,
5168 error not with npm itself.
5168 error Tell the author that this fails on your system:
5168 error     node-gyp rebuild
5168 error You can get information on how to open an issue for this project with:
5168 error     npm bugs libpq
5168 error Or if that isn't available, you can get their info via:
5168 error     npm owner ls libpq
5168 error There is likely additional logging output above.
5169 verbose exit [ 1, true ]

poshest avatar May 18 '16 14:05 poshest

Im getting this as well. Last comment was in May. Have any of you found any work-around?

ktstowell avatar Jun 21 '16 04:06 ktstowell

Not sure what the issue is - I have no problem installing this on any version of node...probably something missing in your environment related to the C libpq not being found on the path or something? Can you type pg_config on your path without issue? That command should provide the path to libpq. the gypfile runs pg_config to find the location of libpq.h

brianc avatar Jun 21 '16 13:06 brianc

Here's mine @brianc:

BINDIR = /usr/local/Cellar/postgresql/9.4.1/bin
DOCDIR = /usr/local/Cellar/postgresql/9.4.1/share/doc/postgresql
HTMLDIR = /usr/local/Cellar/postgresql/9.4.1/share/doc/postgresql
INCLUDEDIR = /usr/local/Cellar/postgresql/9.4.1/include
PKGINCLUDEDIR = /usr/local/Cellar/postgresql/9.4.1/include
INCLUDEDIR-SERVER = /usr/local/Cellar/postgresql/9.4.1/include/server
LIBDIR = /usr/local/Cellar/postgresql/9.4.1/lib
PKGLIBDIR = /usr/local/Cellar/postgresql/9.4.1/lib
LOCALEDIR = /usr/local/Cellar/postgresql/9.4.1/share/locale
MANDIR = /usr/local/Cellar/postgresql/9.4.1/share/man
SHAREDIR = /usr/local/Cellar/postgresql/9.4.1/share/postgresql
SYSCONFDIR = /usr/local/Cellar/postgresql/9.4.1/etc
PGXS = /usr/local/Cellar/postgresql/9.4.1/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--disable-debug' '--prefix=/usr/local/Cellar/postgresql/9.4.1' '--datadir=/usr/local/Cellar/postgresql/9.4.1/share/postgresql' '--docdir=/usr/local/Cellar/postgresql/9.4.1/share/doc/postgresql' '--enable-thread-safety' '--with-bonjour' '--with-gssapi' '--with-ldap' '--with-openssl' '--with-pam' '--with-libxml' '--with-libxslt' '--with-perl' '--with-tcl' '--with-tclconfig=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib' '--with-uuid=e2fs' 'CC=clang'
CC = clang
CPPFLAGS = -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2
CFLAGS_SL = 
LDFLAGS = -L../../../src/common -Wl,-dead_strip_dylibs
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm 
VERSION = PostgreSQL 9.4.1

Chris911 avatar Jun 21 '16 13:06 Chris911

@Chris911 you're error looks weird:

/Users/chris/Documents/Development/Busbud/napi/node_modules/.bin/touch: line 1: syntax error near unexpected token (' /Users/chris/Documents/Development/Busbud/napi/node_modules/.bin/touch: line 1:var touch = require("../touch")' make: *** [Release/obj.target/addon/src/connection.o] Error 2

Particularly the syntax error in a ./touch javascript file. I don't know where the file is coming from or why there's a syntax error in it. Dumb question...but have you done a rm -rf node_modules && npm i? Sometimes this unfortunately helps.

brianc avatar Jun 21 '16 13:06 brianc

Yes I have. I can give it another shot today with Node latest.

Chris911 avatar Jun 21 '16 13:06 Chris911

I just reverified I can compile on [email protected] and [email protected] - I saw the same error @samdj had until I deleted node_modules and reinstalled, but everything else worked without a hitch.

The only other thing I can think of is maybe npm i isn't setting up the path to node-gyp properly when its running so when it attempts to execute a build the node-gyp command is missing. Can you try cloning this module and running npm i && npm test from the root of the project dir?

If that fails try doing these commands from the root of the project dir:

npm i node-gyp
export PATH=$PATH:node_modules/.bin
which node-gyp
node-gyp rebuild
npm i

And see which ones fail

I feel like this might be some weird environment issue

brianc avatar Jun 21 '16 14:06 brianc