ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
192 stars 150 forks source link

Having trouble getting it installed on macOS #465

Closed madsteer closed 6 years ago

madsteer commented 6 years ago

I'm baffled as to what the problem is. Seems to maybe be node-gyp related? Here's a snippet of my package.json file

. . .
"dependencies": {
    "ibm_db": "^2.4.0",
. . .

Here's my output:

npm i

> ibm_db@2.4.0 install /Users/<user>/dev/git/na/etl/node_modules/ibm_db
> node installer/driverInstall.js

Downloading DB2 ODBC CLI Driver from http://<redacted local nexus proxy>/repository/odbc_cli//macos64_odbc_cli.tar.gz...

100.00% | 20080158 bytes downloaded out of 20080158 bytes.

****************************************
You are downloading a package which includes the Node.js module for IBM DB2/Informix.  The module is licensed under the Apache License 2.0. The package also includes IBM ODBC and CLI Driver from IBM, which is automatically downloaded as the node module is installed on your system/device. The license agreement to the IBM ODBC and CLI Driver is available in undefined   Check for additional dependencies, which may come with their own license agreement(s). Your use of the components of the package and dependencies constitutes your acceptance of their respective license agreements. If you do not accept the terms of any license agreement(s), then delete the relevant component(s) from your device.
****************************************

Downloading and extraction of DB2 ODBC CLI Driver completed successfully ...

  CXX(target) Release/obj.target/odbc_bindings/src/odbc.o

{ Error: Command failed: node-gyp configure build  --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"
../src/odbc.cpp:210:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
    data->cb->Call(1, info);
              ^
../../nan/nan.h:1617:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/odbc.cpp:217:80: error: no matching member function for call to 'NewInstance'
    Local<Object> js_result = Nan::New<Function>(ODBCConnection::constructor)->NewInstance(2, info);
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/Users/<user>/.node-gyp/10.9.0/include/node/v8.h:3979:44: note: candidate function not viable: requires single argument 'context', but 2 arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                           ^
/Users/<user>/.node-gyp/10.9.0/include/node/v8.h:3976:44: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                           ^
../src/odbc.cpp:222:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
    data->cb->Call(2, info);
              ^
../../nan/nan.h:1617:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/odbc.cpp:262:78: error: no matching member function for call to 'NewInstance'
  Local<Object> js_result = Nan::New<Function>(ODBCConnection::constructor)->NewInstance(2, params);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/Users/<user>/.node-gyp/10.9.0/include/node/v8.h:3979:44: note: candidate function not viable: requires single argument 'context', but 2 arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                           ^
/Users/<user>/.node-gyp/10.9.0/include/node/v8.h:3976:44: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                           ^
../src/odbc.cpp:1194:7: warning: 'Call' is deprecated [-Wdeprecated-declarations]
  cb->Call(1, info);
      ^
../../nan/nan.h:1617:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/odbc.cpp:1258:87: error: too few arguments to function call, expected 2, have 1
      objError->SetPrototype(Exception::Error(Nan::New(errorMessage).ToLocalChecked()));
      ~~~~~~~~~~~~~~~~~~~~~~                                                          ^
/Users/<user>/.node-gyp/10.9.0/include/node/v8.h:3425:3: note: 'SetPrototype' declared here
  V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context,
  ^
/Users/<user>/.node-gyp/10.9.0/include/node/v8config.h:416:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
3 warnings and 3 errors generated.
make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/<user>/.npm-global/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/<user>/.npm-global/lib/node_modules/node/bin/node" "/Users/<user>/.npm-global/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/Users/<user>/dev/git/na/etl/node_modules/ibm_db/installer/clidriver"
gyp ERR! cwd /Users/<user>/dev/git/na/etl/node_modules/ibm_db
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

    at ChildProcess.exithandler (child_process.js:289:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:961:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)
  killed: false,
  code: 1,
  signal: null,
  cmd:
   'node-gyp configure build  --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"' }
npm WARN cortex-etl@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ibm_db@2.4.0 install: `node installer/driverInstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ibm_db@2.4.0 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:
bimalkjha commented 6 years ago

node -v v10.9.0 -> It is the problem. Please use node v < 10.x and it should work. Thanks.

bimalkjha commented 6 years ago

@madsteer Also, check this link for info if you still face xcode related issues after using lower version of node. Thanks.

madsteer commented 6 years ago

I downgraded node. Don't think I'm having an Xcode issue now. trying to go to 104.20.22.46 which is not allowed for me at work. Do you know where it's going and what for?

100.00% | 20080158 bytes downloaded out of 20080158 bytes.

****************************************
You are downloading a package which includes the Node.js module for IBM DB2/Informix.  The module is licensed under the Apache License 2.0. The package also includes IBM ODBC and CLI Driver from IBM, which is automatically downloaded as the node module is installed on your system/device. The license agreement to the IBM ODBC and CLI Driver is available in undefined   Check for additional dependencies, which may come with their own license agreement(s). Your use of the components of the package and dependencies constitutes your acceptance of their respective license agreements. If you do not accept the terms of any license agreement(s), then delete the relevant component(s) from your device.
****************************************

Downloading and extraction of DB2 ODBC CLI Driver completed successfully ...

{ Error: Command failed: node-gyp configure build  --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: connect ETIMEDOUT 104.20.22.46:443
gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/<user>/.npm-global/lib/node_modules/node/bin/node" "/Users/<user>/.npm-global/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/Users/<user>/dev/git/na/etl/node_modules/ibm_db/installer/clidriver"
gyp ERR! cwd /Users/<user>/dev/git/na/etl/node_modules/ibm_db
gyp ERR! node -v v9.11.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

    at ChildProcess.exithandler (child_process.js:273:12)
    at ChildProcess.emit (events.js:180:13)
    at maybeClose (internal/child_process.js:936:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'node-gyp configure build  --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"' }
npm WARN cortex-etl@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ibm_db@2.4.0 install: `node installer/driverInstall.js`
npm ERR! Exit status 1
madsteer commented 6 years ago

it's trying to get the headers tar from https://nodejs.org/download/release/v8.12.0/node-v8.12.0-headers.tar.gz If I get that resolved, I think it will install.

bimalkjha commented 6 years ago

@madsteer Change ibm_db version to 2.4.1 in package.json too. Thanks.

bimalkjha commented 6 years ago

gyp ERR! cwd /Users/<user>/dev/git/na/etl/node_modules/ibm_db

Why it is /Users/<user>/... ? Shouldn't it use your username instead of here? If you do not have env var USER defined, then set it using command export USER=<your_user_id>

madsteer commented 6 years ago

I have a username. It redacted it for security reasons. I’ll double check the version in package.json

madsteer commented 6 years ago

I got this to work by doing the following (keep in mind that corporate firewall prevents direct access to the internet).

$ node -v
v8.12.0 # make sure the version is < 10.* and note the version for the commands below
$ curl -o node-v8.12.0-headers.tar.gz <approved method for downloading https://nodejs.org/download/release/v8.12.0/node-v8.12.0-headers.tar.gz>
$ IBM_DB_INSTALLER_URL="<approved method for accessing the IBM repository/odbc_cli//<your plaform>_odbc_cli.tar.gz> npm i --tarball=<FQP/to/where/you/downloaded/>node-v8.12.0-headers.tar.gz