ibmdb / node-ibm_db

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

Bug Report - Could not locate the bindings file. #984

Closed VinnyV88 closed 4 months ago

VinnyV88 commented 4 months ago

Hello, I'm in the process of updating a website written a few years ago. I'm upgrading to the latest versions of O/S, db, Node and all library dependencies. I'm working on a Windows 11 PC, using WSL2, Linux Ubuntu O/S.

I've seen this issue has come up in the past and try the various fixes, but I have not had any luck getting this to work.

Please provide below information while opening an issue to understand your problem

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

uname:Linux uname -m: x86_64 node -v:v20.11.1 npm ls ibm_db:

srspf-website@1.0.0 /home/vinnyv88/dev/srspf-website
└── ibm_db@3.2.3

db2level: db2level: command not found echo $IBM_DB_HOME: ` echo $PATH:/home/vinnyv88/.nvm/versions/node/v20.11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/Microsoft/jdk-11.0.16.101-hotspot/bin:/mnt/c/Python38/Scripts/:/mnt/c/Python38/:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/nodejs/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/PuTTY/:/mnt/c/Users/Vinny/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Vinny/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/Vinny/AppData/Roaming/npm:/mnt/c/adb:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn/:/mnt/c/Program Files/Azure Data Studio/bin:/mnt/c/Program Files/dotnet/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/IBM/Client Access/Shared:/mnt/c/Program Files (x86)/IBM/Client Access/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Users/Vinny/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Vinny/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/Vinny/AppData/Roaming/npm:/mnt/c/Users/Vinny/.dotnet/tools:/mnt/c/Program Files/Azure Data Studio/bin:/mnt/c/Users/Vinny/AppData/Local/gitkraken/bin:/mnt/c/Users/Vinny/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Vinny/.dotnet/tools:/snap/bin echo $LD_LIBRARY_PATH$DYLD_LIBRARY_PATH:`

For Windows system, output of below commands from windows command prompt:

node -v npm ls ibm_db db2level echo %IBM_DB_HOME% echo %PATH% echo %LIB%

Please provide below problem specific info:

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

For Installation related issue

up to date, audited 534 packages in 3s

37 packages are looking for funding run npm fund for details

13 vulnerabilities (4 moderate, 6 high, 3 critical)

To address issues that do not require attention, run: npm audit fix

To address all issues possible (including breaking changes), run: npm audit fix --force

Some issues need review, and may require choosing a different dependency.

Run npm audit for details.


- For MacOS M1/M2 Chip system, please follow this documentation - https://github.com/ibmdb/node-ibm_db/blob/master/INSTALL.md#m1chip

### For Connection related issue
  1. Are you trying SSL connection or non-SSL connection?
  2. For SSL Connection, please read and follow [this documentation](https://github.com/ibmdb/node-ibm_db/blob/master/APIDocumentation.md#SSLConnection)
  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.json` file and share complete output of below commands:
  * cd .../node_modules/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.

### For SQL1598N Error
- Please follow [this documentation](https://github.com/ibmdb/node-ibm_db#sql1598n).

### For other issues
- Test script to reproduce the problem.

One of the fixes for this issue in the past suggested to cd to the node_modules/ibm_db folder and run npm install there, so I did and wanted to provide that results:

vinnyv88@ViViD-Laptop:~/dev/srspf-website/node_modules/ibm_db$ npm i

ibm_db@3.2.3 install node installer/driverInstall.js

platform = linux, arch = x64, node.js version = v20.11.1 make ✖ ERR Missing Makefile / Bakefile make ℹ info Run "make init" to generate a Makefile. make version = Rebuild Process: Found clidriver at -> /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/installer/clidriver

Downloading of clidriver skipped - build is in progress...

ibm_db installed successfully.

added 50 packages, and audited 51 packages in 4s

3 packages are looking for funding run npm fund for details

found 0 vulnerabilities vinnyv88@ViViD-Laptop:~/dev/srspf-website/node_modules/ibm_db$


Steps to Reproduce:

1. Update config.json with connection details to IBM i DB2.
2. Run test-basic-test-.js

vinnyv88@ViViD-Laptop:~/dev/srspf-website/node_modules/ibm_db$ node test/test-basic-test.js /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/node_modules/bindings/bindings.js:135 throw err; ^

Error: Could not locate the bindings file. Tried: → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/build/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/build/Debug/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/build/Release/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/out/Debug/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/Debug/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/out/Release/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/Release/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/build/default/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/compiled/20.11.1/linux/x64/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/addon-build/release/install-root/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/addon-build/debug/install-root/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/addon-build/default/install-root/odbc_bindings.node → /home/vinnyv88/dev/srspf-website/node_modules/ibm_db/lib/binding/node-v115-linux-x64/odbc_bindings.node at bindings (/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/node_modules/bindings/bindings.js:126:9) at Object. (/home/vinnyv88/dev/srspf-website/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. (/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/test/common.js:1:12) at Module._compile (node:internal/modules/cjs/loader:1376:14) { tries: [ '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/build/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/build/Debug/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/build/Release/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/out/Debug/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/Debug/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/out/Release/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/Release/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/build/default/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/compiled/20.11.1/linux/x64/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/addon-build/release/install-root/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/addon-build/debug/install-root/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/addon-build/default/install-root/odbc_bindings.node', '/home/vinnyv88/dev/srspf-website/node_modules/ibm_db/lib/binding/node-v115-linux-x64/odbc_bindings.node' ] }

Node.js v20.11.1

bimalkjha commented 4 months ago

@VinnyV88 The output of npm i command under node_modules/ibm_db directory displays the Make error. make version is empty. Make is required to compile native code and generate bindings file. Please install make in your system and make sure commands make --version and gcc --version both are working without any error. Then rerun the npm i command under ibm_db directory again. It should fix the issue. We have clearly documented the requirement of make and gcc for non-windows systems in the documentation of ibm_db as prerequisite here: https://github.com/ibmdb/node-ibm_db?tab=readme-ov-file#prerequisite Thanks.

VinnyV88 commented 4 months ago

Thank you, @bimalkjha for the reply. I did go through the prerequisites and installed the required software.

I did end up resolving the issue, but I wanted to share the process I went through in case someone else runs into the same issue I was having.

To confirm, I tried to install Make again:

vinnyv88@ViViD-Laptop:~$ sudo apt install make
[sudo] password for vinnyv88:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
make is already the newest version (4.3-4.1build1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

But, the Make error was suspicious so I looked more into it. The make --version command said I needed to run make init. So I did and then make --version returned 0.8.1.

vinnyv88@ViViD-Laptop:~$ make --version
make ✖ ERR  Missing Makefile / Bakefile
make ℹ info Run "make init" to generate a Makefile.
vinnyv88@ViViD-Laptop:~$ make init
make ℹ info Running default template in  /home/vinnyv88
make ℹ info .npmignore    -> ./.npmignore
make ℹ info .eslintignore -> ./.eslintignore
make ℹ info Makefile      -> ./Makefile
make ℹ info package.json  -> ./package.json
make ℹ info Build success in 14ms
vinnyv88@ViViD-Laptop:~$ make --version
0.8.1

That didn't match the 4.3-4.1build1 returned when I ran the make install earlier. So, after more research, I found this article: https://askubuntu.com/questions/1146289/unable-to-run-makefile-targets-in-windows-subsystem-for-linux-ubuntu-18-04.

Apparently I had an NPM Make package installed which was blocking GNU Make from running. so I ran npm uninstall make -g to remove the NPM package and everything worked from there.

Thanks again, have a great day!