ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
188 stars 151 forks source link

Unable to install ibm_db on z/os #939

Closed srinivasabommareddy closed 10 months ago

srinivasabommareddy commented 10 months ago

Unable to install ibm_db on z/os

For non-Windows system, output of below commands from terminal:

$ npm install ibm_db npm ERR! code 1 npm ERR! path /u/ttbr/home/bomms/TestDB/node_modules/ibm_db npm ERR! command failed npm ERR! command sh -c node installer/driverInstall.js npm ERR! platform = os390, arch = s390x, node.js version = v18.14.2 npm ERR! Unable to find 'make' in PATH. Installation may fail! npm ERR! npm ERR! Error: Command failed: node-gyp configure build --IS_DOWNLOADED=false --IBM_DB_HOME="$IBM_DB_HOME" npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.3.1 npm ERR! gyp info using node@18.14.2 | os390 | s390x npm ERR! gyp info find Python using Python version 3.10.7 found at "/usr/lpp/ported/road4z/bin/python3" npm ERR! gyp http GET https://nodejs.org/download/release/v18.14.2/node-v18.14.2-headers.tar.gz npm ERR! gyp WARN install got an error, rolling back install npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.14.2/node-v18.14.2-headers.tar.gz faile d, reason: unable to verify the first certificate npm ERR! gyp ERR! stack at ClientRequest. (/CTQ111/usr/lpp/IBM/cnj/v18r0/IBM/node-v18.14.2-os390-s390x-20230323 1340/lib/node_modules/npm/node_modules/node-gyp/node_modules/minipass-fetch/lib/index.js:130:14) npm ERR! gyp ERR! stack at ClientRequest.emit (node:events:513:28) npm ERR! gyp ERR! stack at TLSSocket.socketErrorListener (node:_http_client:502:9) npm ERR! gyp ERR! stack at TLSSocket.emit (node:events:513:28) npm ERR! gyp ERR! stack at emitErrorNT (node:internal/streams/destroy:151:8) npm ERR! gyp ERR! stack at emitErrorCloseNT (node:internal/streams/destroy:116:3) npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21) npm ERR! gyp ERR! System OS/390 28.00 npm ERR! gyp ERR! command "/CTQ111/usr/lpp/IBM/cnj/v18r0/IBM/node-v18.14.2-os390-s390x-202303231340/bin/node" "/CTQ111/usr/lpp /IBM/cnj/v18r0/IBM/node-v18.14.2-os390-s390x-202303231340/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configu re" "build" "--IS_DOWNLOADED=false" "--IBM_DB_HOME=SYSDB2.DQA0" npm ERR! gyp ERR! cwd /u/ttbr/home/bomms/TestDB/node_modules/ibm_db npm ERR! gyp ERR! node -v v18.14.2 npm ERR! gyp ERR! node-gyp -v v9.3.1 npm ERR! gyp ERR! not ok npm ERR! npm ERR! at ChildProcess.exithandler (node:child_process:419:12) npm ERR! at ChildProcess.emit (node:events:513:28) npm ERR! at maybeClose (node:internal/child_process:1134:16) npm ERR! at Socket. (node:internal/child_process:492:11) npm ERR! at Socket.emit (node:events:513:28) npm ERR! at Pipe. (node:net:322:12) { npm ERR! code: 1, npm ERR! killed: false, npm ERR! signal: null, npm ERR! cmd: 'node-gyp configure build --IS_DOWNLOADED=false --IBM_DB_HOME="$IBM_DB_HOME"' npm ERR! } npm ERR! make: Error -- FSUM8705 No target npm ERR! oput 'SYSDB2.DQA0.SDSNMACS(DSNAO64C)' '/u/ttbr/home/bomms/TestDB/node_modules/ibm_db/build/dsnao64c.x'

npm ERR! A complete log of this run can be found in: npm ERR! /u/ttbr/home/bomms/.npm/_logs/2023-08-17T13_53_49_862Z-debug-0.log $ node --version v18.14.2

output of below commands from windows command prompt:

$ $ node -v v18.14.2 $

$ $ npm ls ibm_db testdb@1.0.0 /u/ttbr/home/bomms/TestDB `-- (empty)

$

$ echo $IBM_DB_HOME SYSDB2.DQA0 $

$ echo $PATH /bin:/usr/sbin:.:/usr/lpp/ported/road4z/bin:/usr/lpp/java/J8.0_64/bin:/usr/lpp/IBM/cnj/v18r0/IBM/node-latest-os390-s390x/bin:/service/rocket/python/python-2017-04-12-py36/python36/bin:/usr/lpp/ported/openssl/bin:/usr/lpp/IBM/dbb:/usr/lpp/IBM/dbb/migration/bin:/usr/lpp/ported/curl/bin $

$ $ echo $LIB ▒ $

Please provide below problem specific info:

=========================================

For Installation related issue

For Connection related issue

  1. Are you trying SSL connection or non-SSL connection?
  2. For SSL Connection, please read and follow this documentation
  3. For SSL connection, do you have ssl certificate from server?
  4. If you have certificate, are you using SSLServerCertificate keyword in connection string or using your own keystore db?
  5. Share the connection string used for connection by masking password.
  6. update database connection info in ibm_db/test/config.testConnectionStrings.json file and share complete output of below commands:
    • cd .../ibm_db
    • npm install
    • node test/test-basic-test.js
  7. For non-SSL connection, update connection info for db2cli validate command in file ibm_db/installer/testODBCConnection.bat for windows or ibm_db/installer/testODBCConnection.sh for non-Windows. Then execute testODBCConnection.bat from Administrator command prompt on Windows or testODBCConnection.sh script from terminal on non-Windows and share complete output of script along will all generated 1.* files in zip file.
  8. Complete output of db2cli validate command.

Steps to Reproduce:

  1. npm install ibm_db
bimalkjha commented 10 months ago

@srinivasabommareddy Please configure ODBC driver on z/OS as documented here and then try. Thanks.

bimalkjha commented 10 months ago

285 error gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.14.2/node-v18.14.2-headers.tar.gz failed, reason: unable to verify the first certificate

It seems download of node.js header files from internet is throwing error due to missing SSL certificate file. Please try to download https://nodejs.org/download/release/v18.14.2/node-v18.14.2-headers.tar.gz manually on this system. Are you able to download? Thanks.

srinivasabommareddy commented 10 months ago

@srinivasabommareddy Please configure ODBC driver on z/OS as documented here and then try. Thanks.

Hello Bimal, Thank you so much for your quick response. ODBC driver on z/OS was configured. We have been using ODBC driver from Python for a while.

Regards, Reddy

srinivasabommareddy commented 10 months ago

285 error gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.14.2/node-v18.14.2-headers.tar.gz failed, reason: unable to verify the first certificate

It seems download of node.js header files from internet is throwing error due to missing SSL certificate file. Please try to download https://nodejs.org/download/release/v18.14.2/node-v18.14.2-headers.tar.gz manually on this system. Are you able to download? Thanks.

Hello Bimal

I can access the link and able to download from the link.

request to https://nodejs.org/download/release/v18.14.2/node-v18.14.2-headers.tar.gz failed, reason: unable to verify the first certificate npm ERR! gyp ERR! stack at ClientRequest. (/CTQ111/usr/lpp/IBM/cnj/v18r0/IBM/node-v18.14.2-os390-s390x-202303231340/lib/node_modules/npm/node_modules/node-gyp/node_modules/minipass-fetch/lib/index.js:130:14)

Not sure but looks like some issue with SSL handshake. Did you come across similar issue in the past?

bimalkjha commented 10 months ago

@srinivasabommareddy Yes it is issue with SSL handshake and similar issues has been reported by users in past on different platforms though very less. After correcting the firewall settings or opening nodejs.org in browser and saving certificate have been resolved the issues. Here are few suggestions:

  1. Run below commands in sequence:
    export NODE_TLS_REJECT_UNAUTHORIZED=0
    npm install ibm_db
    export NODE_TLS_REJECT_UNAUTHORIZED=
  2. You can try to change the registry to the http version in config using below command and then try installation:
    npm config set registry http://registry.npmjs.org/ --global
    npm install ibm_db
  3. You can try to disable SSL using below command and then install ibm_db:
    npm config set strict-ssl false
    npm install ibm_db
    npm config set strict-ssl true
  4. It may be problem with this version of node.js, so you may try to install ibm_db after installing another version of node.js. Thanks.
srinivasabommareddy commented 10 months ago

@srinivasabommareddy Yes it is issue with SSL handshake and similar issues has been reported by users in past on different platforms though very less. After correcting the firewall settings or opening nodejs.org in browser and saving certificate have been resolved the issues. Here are few suggestions:

  1. Run below commands in sequence:
export NODE_TLS_REJECT_UNAUTHORIZED=0
npm install ibm_db
export NODE_TLS_REJECT_UNAUTHORIZED=
  1. You can try to change the registry to the http version in config using below command and then try installation:
npm config set registry http://registry.npmjs.org/ --global
npm install ibm_db
  1. You can try to disable SSL using below command and then install ibm_db:
npm config set strict-ssl false
npm install ibm_db
npm config set strict-ssl true
  1. It may be problem with this version of node.js, so you may try to install ibm_db after installing another version of node.js. Thanks.

Tried first three options.

Option 1 - Same error Option 2 - Not able to set the registry..

    $ npm config set registry http://registry.npmjs.org/ --global

npm ERR! code ENOENT npm ERR! syscall mkdir npm ERR! path /CTQ111/usr/lpp/IBM/cnj/v18r0/IBM/node-v18.14.2-os390-s390x-202303 231340/etc npm ERR! errno -129 npm ERR! enoent ENOENT: no such file or directory, mkdir '/CTQ111/usr/lpp/IBM/cn j/v18r0/IBM/node-v18.14.2-os390-s390x-202303231340/etc' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in: npm ERR! /u/ttbr/home/bomms/.npm/_logs/2023-08-21T13_35_02_033Z-debug-0.log

Option 3 - I have been using Option 3 all along.

Tried with Node 12:

$ npm install ibm_db (node:84021024) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment va riable to '0' makes TLS connections and HTTPS requests insecure by disabling cer tificate verification.

ibm_db@3.2.1 install /u/ttbr/home/bomms/node_modules/ibm_db node installer/driverInstall.js

node: --openssl-legacy-provider is not allowed in NODE_OPTIONS npm WARN bomms@1.0.0 No description npm WARN bomms@1.0.0 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 9 npm ERR! ibm_db@3.2.1 install: node installer/driverInstall.js npm ERR! Exit status 9 npm ERR! npm ERR! Failed at the ibm_db@3.2.1 install script. npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /u/ttbr/home/bomms/.npm/_logs/2023-08-21T14_58_23_504Z-debug.log $

bimalkjha commented 10 months ago

@srinivasabommareddy I see similar issue being discussed here: https://stackoverflow.com/questions/40000952/unable-to-verify-the-first-certificate-when-running-npm-install Please check the solutions if anyone can work for you. You can try to reach z/OS expert if they can suggest any solution to overcome this SSL error. Try using node.js v16.x or v20.x. Thanks.

bimalkjha commented 8 months ago

Wayne Zhang(https://ibm-analytics.slack.com/archives/C11EQ8CVB/p1698345145515419?thread_ts=1698319024.984109&cid=C11EQ8CVB) It looks like there is a GET request being made to https://nodejs.org/download/release/v18.14.2/node-v18.14.2-headers.tar.gz according to the logs you linked. However, this request shouldn't be necessary when npm_config_nodedir and npm_config_zoslib_include_dir are set correctly. Can you ask them to confirm that they performed all the installation steps as documented in https://www.ibm.com/docs/en/sdk-nodejs-zos/18.0?topic=configuring-installing-pax-format ? If they did not perform the . /.env step then the above environment variables would not be set. They can validate whether the environment variables are set correctly or not by running env | grep npmconfig

Setting the environment variables as suggested above has fixed the SSL connection issue. Thanks.