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@2.8.2 on windows with node v18.16.1 #947

Closed MandiraRoyMukherjee closed 9 months ago

MandiraRoyMukherjee commented 9 months ago

node version 18.16.1 window 64 bit this issue I have been facing whenever am running npm i

code 1 npm ERR! path C:\Users\004QG0744\CERT\node_modules\ibm_db npm ERR! command failed npm ERR! command C:\windows\system32\cmd.exe /d /s /c node installer/driverInstall.js npm ERR! platform = win32, arch = ia32, node.js version = v18.16.1 npm ERR! Unable to determine driver download file. Exiting the install process. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\004QG0744\AppData\Local\npm-cache_logs\2023-09-14T06_56_34_578Z-debug-0.log

bimalkjha commented 9 months ago

@MandiraRoyMukherjee Check this error in the output: npm ERR! platform = win32, arch = ia32,. It says you have installed 32bit Node.js. You need to install 64-bit Nodejs so that arch=x64 should come in the output. Please check your OS version too. It may be 32bit. ibm_db do not support 32bit Nodejs on windows. Thanks.

MandiraRoyMukherjee commented 9 months ago

yes i installed 64bit node js but after npm run debug command its giving this error now.

window 11,64bit node js version 18.16.1

[server-debug] Error: \?\C:\Users\004QG0744\CERT\node_modules\ibm_db\build\Release\odbc_bindings.node is not a valid Win32 application. [server-debug] \?\C:\Users\004QG0744\CERT\node_modules\ibm_db\build\Release\odbc_bindings.node [server-debug] at Module._extensions..node (node:internal/modules/cjs/loader:1340:18) [server-debug] at Module.load (node:internal/modules/cjs/loader:1119:32) [server-debug] at Module._load (node:internal/modules/cjs/loader:960:12) [server-debug] at Module.require (node:internal/modules/cjs/loader:1143:19) [server-debug] at require (node:internal/modules/cjs/helpers:110:18) [server-debug] at bindings (C:\Users\004QG0744\CERT\node_modules\bindings\bindings.js:112:48) [server-debug] at Object. (C:\Users\004QG0744\CERT\node_modules\ibm_db\lib\odbc.js:57:31) [server-debug] at Module._compile (node:internal/modules/cjs/loader:1256:14) [server-debug] at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) [server-debug] at Module.load (node:internal/modules/cjs/loader:1119:32) [server-debug] at Module._load (node:internal/modules/cjs/loader:960:12) [server-debug] at Module.require (node:internal/modules/cjs/loader:1143:19) [server-debug] at require (node:internal/modules/cjs/helpers:110:18) [server-debug] at Object. (C:\Users\004QG0744\CERT\skills-shared\Services\DB2Service.js:2:11) [server-debug] at Module._compile (node:internal/modules/cjs/loader:1256:14) [server-debug] at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) { [server-debug] code: 'ERR_DLOPEN_FAILED' [server-debug] } [server-debug] [server-debug] Node.js v18.16.1

bimalkjha commented 9 months ago

@MandiraRoyMukherjee npm run debug is used to start the app in debug mode. Are you able to start the app in non-debug mode? Please share complete output of below commands from command prompt and not partial:

cd C:\Users\004QG0744\CERT\node_modules\ibm_db
npm install
cd test
open config.testConnectionStrings.json and update database connection info in this file and save it.
node test-basic-test.js

If node test-basic-test.js works fine, means there is no issue with ibm_db. Thanks.

MandiraRoyMukherjee commented 9 months ago

@bimalkjha Hi, after running the following command

C:\Users\004QG0744\CERT\node_modules\ibm_db\test>node test-basic-test.js C:\Users\004QG0744\CERT\node_modules\ibm_db\node_modules\bindings\bindings.js:121 throw e; ^

Error: \?\C:\Users\004QG0744\CERT\node_modules\ibm_db\build\Release\odbc_bindings.node is not a valid Win32 application. \?\C:\Users\004QG0744\CERT\node_modules\ibm_db\build\Release\odbc_bindings.node at Module._extensions..node (node:internal/modules/cjs/loader:1340:18) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (node:internal/modules/cjs/helpers:110:18) at bindings (C:\Users\004QG0744\CERT\node_modules\ibm_db\node_modules\bindings\bindings.js:112:48) at Object. (C:\Users\004QG0744\CERT\node_modules\ibm_db\lib\odbc.js:57:31) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) { code: 'ERR_DLOPEN_FAILED' }

Node.js v18.16.1

this same error coming

MandiraRoyMukherjee commented 9 months ago

{ "DRIVER" : "{DB2 ODBC Driver}", "DATABASE" : "SAMPLE", "UID" : "newton", "PWD" : "xxxxxx", "HOSTNAME" : "waldevdbclnxtst06.dev.rocketsoftware.com", "PORT" : 60000, "PROTOCOL" : "TCPIP" }

this are the content in that config.testConnectionStrings.json file

bimalkjha commented 9 months ago

@MandiraRoyMukherjee You have not shared complete output of npm install command. I still need complete output not partial of npm install to understand what is happening in your system. Thanks.

bimalkjha commented 9 months ago

You have not provided any info as requested in new issue template. Without those info, it is difficult to understand the root cause. If you do not share any info but just ask it is not working, how can we help you? Please share all the info. Thanks.

MandiraRoyMukherjee commented 9 months ago

@bimalkjha after npm i one error coming

C:\Users\004QG0744\CERT\node_modules\ibm_db>npm install

ibm_db@2.8.2 install node installer/driverInstall.js

platform = win32, arch = x64, node.js version = v18.16.1


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 C:\Users\004QG0744\CERT\node_modules\ibm_db\installer\clidriver. 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 DB2 ODBC CLI Driver from https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ntx64_odbc_cli.zip ...

100.00% | 26304963 bytes downloaded out of 26304963 bytes.

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 info it worked if it ends with ok gyp info using node-gyp@9.3.1 gyp info using node@18.16.1 | win32 | x64 gyp info find Python using Python version 3.11.5 found at "C:\Python311\python.exe" gyp ERR! find VS gyp ERR! find VS msvs_version not set from command line or npm config gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! find VS checking VS2019 (16.11.34031.81) found at: gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools" gyp ERR! find VS - found "Visual Studio C++ core features" gyp ERR! find VS - found VC++ toolset: v142 gyp ERR! find VS - missing any Windows SDK gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use gyp ERR! find VS looking for Visual Studio 2015 gyp ERR! find VS - not found gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 gyp ERR! find VS gyp ERR! find VS ** gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the "Desktop development with C++" workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows gyp ERR! find VS ** gyp ERR! find VS gyp ERR! configure error gyp ERR! stack Error: Could not find any Visual Studio installation to use gyp ERR! stack at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14 gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:390:16 gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7 gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16 gyp ERR! stack at ChildProcess.exithandler (node:child_process:427:5) gyp ERR! stack at ChildProcess.emit (node:events:513:28) gyp ERR! stack at maybeClose (node:internal/child_process:1091:16) gyp ERR! System Windows_NT 10.0.22621 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=$IBM_DB_HOME" gyp ERR! cwd C:\Users\004QG0744\CERT\node_modules\ibm_db gyp ERR! node -v v18.16.1 gyp ERR! node-gyp -v v9.3.1 gyp ERR! not ok

at ChildProcess.exithandler (node:child_process:419:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Pipe.<anonymous> (node:net:322:12) {

code: 1, killed: false, signal: null, cmd: 'node-gyp configure build --IS_DOWNLOADED=true --IBM_DB_HOME=$IBM_DB_HOME' }

node-gyp build process failed!

Proceeding with Pre-compiled Binary Installation.

=================================== ibm_db installed successfully.

up to date, audited 63 packages in 55s

4 packages are looking for funding run npm fund for details

found 0 vulnerabilities

bimalkjha commented 9 months ago

@MandiraRoyMukherjee Thanks for sharing complete output of npm install command. Now we can know that you have installed ibm_db version 2.8.2 in your system which is very old release. I would suggest to install the latest version of ibm_db which has fix of this issue. The problem is due to use of unzipper package in ibm_db@2.8.2 which fails to extract pre-compiled binary properly. The issue is with unzipper package, so in latest release we are using Adm-zip package to unzip the build.zip file. unzipper has security vulnerability too and it is no longer maintained.

If you still want to use ibm_db@2.8.2, then follow below steps:

cd C:\Users\004QG0744\CERT\node_modules\ibm_db
unzip build.zip file manually in current directory.
or, unzip the build.zip file in other directory manually and copy file build\Release\odbc_bindings.node 
and paste it under ibm_db\build\Release directory.

Note that, since unzipper package corrupts odbc_bindings.node while unzipping it, so you are getting bad Win32 file error. You just need to manually unzip build.zip file and get the correct odbc_bindings.node file from it and paste it as ibm_db\build\Release\odbc_bindings.node. It should work fine. Thanks.