ibmdb / node-ibm_db

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

Having trouble get a valid npm install in a GitLab CI Pipeline #985

Closed madsteer closed 3 months ago

madsteer commented 4 months ago

Please provide below problem specific info:

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

We run several nodeJS apps out of Docker images on an internal Kubernetes cluster. Due to firewalls etc. protecting the company's internal network it's easier to set up credentials in the pipeline and do the "npm install" in a pipeline step versus trying to set all the config up in a Dockerfile and do the "npm install" in the docker build. Then in the Dockerfile for the docker build you just copy in the node_modules directory. We have several apps NOT using ibm_db and this method works pretty good. However, while npm install seems to succeed for the ibm_db module (no errors that I can find in the output etc.). I end up getting the

Error: Could not locate the bindings file. Tried:
 → /usr/node/node_modules/ibm_db/build/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/build/Debug/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/build/Release/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/out/Debug/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/Debug/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/out/Release/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/Release/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/build/default/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/compiled/20.11.1/linux/x64/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/addon-build/release/install-root/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/addon-build/debug/install-root/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/addon-build/default/install-root/odbc_bindings.node
 → /usr/node/node_modules/ibm_db/lib/binding/node-v115-linux-x64/odbc_bindings.node
    at bindings (/usr/node/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/usr/node/node_modules/ibm_db/lib/odbc.js:57:31)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/usr/node/src/db/minddb.js:1:15)
    at Module._compile (node:internal/modules/cjs/loader:1376:14) {
  tries: [
    '/usr/node/node_modules/ibm_db/build/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/build/Debug/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/build/Release/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/out/Debug/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/Debug/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/out/Release/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/Release/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/build/default/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/compiled/20.11.1/linux/x64/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/addon-build/release/install-root/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/addon-build/debug/install-root/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/addon-build/default/install-root/odbc_bindings.node',
    '/usr/node/node_modules/ibm_db/lib/binding/node-v115-linux-x64/odbc_bindings.node'
  ]
}

type error in the running container when trying to run the app, which I assume means the npm install isn't working. Some things to note:

  1. The docker image I'm using in the "npm install" step in the pipeline is the same image I'm basing my build off of in the Dockerfile for the docker buildbuild.
  2. If I pull the resulting Docker image down to my workstation, spin up a running container, and re-run the npm install to rebuild the module that seems to succeed and provide a working module.
  3. To help me confirm that what I'm building in the "npm install" step matches what I'm copying in, in the docker build I ran a cksum ./node_modules/ibm_db/binding.gyp in multiple places to verify I have what I think I have (but maybe that's not the right file to be checking??).

I do think maybe the issue is I have a node_modules/ibm_db/build.zip file instead of a node_modules/ibm_db/build folder. I'm not quite sure what that means, but other issues suggest a bad ODBC cli tarball? I have a linuxx64_odbc_cli.tar.gz file, but perhaps I'm not pointing to it correctly during the npm install?

I don't consider this a "bug report" so much as a plea for help. If anyone has experience doing this and has any thoughts or suggestions I'm "all ears". What can I be checking for? what kinds of problems cause the npm install to succeed without error but cause this missing bindings file at execute time?

bimalkjha commented 3 months ago

@madsteer I suspect there was some uncaught error during installation. Could you please share the complete output of command npm install ibm_db --verbose. If you are using linuxx64_odbc_cli.tar.gz file locally, make sure this file is transferred in binary mode to avoid corruption. Also, you need to set system level environment variable IBM_DB_INSTALLER_URL=full path of linuxx64_odbc_cli.tar.gz file before installing ibm_db so that this file could get used by ibm_db. Search for IBM_DB_INSTALLER_URL on https://github.com/ibmdb/node-ibm_db page to know more about his environment variable. Thanks.

bimalkjha commented 3 months ago

If npm install ibm_db --verbose do not give much info, cd to ibm_db directory post install and run npm install to get detailed output. Make sure GCC and Make is available on non-windows platform before installation of ibm_db. Thanks.