ibmdb / node-ibm_db

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

TypeError: Cannot read property 'indexOf' of undefined - nodejs electron app #923

Closed orizzontiholding closed 1 year ago

orizzontiholding commented 1 year ago

I'm trying to use this library inside an electron application that will use vue for the front-end. after I've installed it using the flag to specify the electron version npm i ibm_db -electron="13.0.0" when I try to call it from the main.js file of the app I will always get this error when the app start

TypeError: Cannot read property 'indexOf' of undefined
    at Function.getFileName (webpack:///./node_modules/bindings/bindings.js?:178:16)
    at bindings (webpack:///./node_modules/bindings/bindings.js?:82:48)
    at eval (webpack:///./node_modules/ibm_db/lib/odbc.js?:57:86)
    at Object../node_modules/ibm_db/lib/odbc.js (C:\Users\myuser\Desktop\tool\dist_electron\index.js:1125:1)
    at __webpack_require__ (C:\Users\myuser\Desktop\tool\dist_electron\index.js:20:30)
    at eval (webpack:///./src/background.js?:12:64)
    at Module../src/background.js (C:\Users\myuser\Desktop\tool\dist_electron\index.js:3121:1)
    at __webpack_require__ (C:\Users\myuser\Desktop\tool\dist_electron\index.js:20:30)
    at eval (webpack:///multi_./src/background.js?:1:18)
    at Object.0 (C:\Users\myuser\Desktop\tool\dist_electron\index.js:3144:1)
In my system I've already configured all the needed drivers from ibm and I'va also installed the latest ibm drivers for db2. 
I'm running electron 13.0.0 on windows 11 machine and my node version is 16.0.0 for this project but globally I have the node version 18.12.1 installed. 

I've laso tried to set the IBM_DB_HOME globally on my system and it's set to the folder where the driver are installed, but the problem still remain. How I can make the library work correctly to connect with my on premise db2 instance?
bimalkjha commented 1 year ago

@orizzontiholding Would you be able to use the newer version of electron? If you install ibm_db using npm i ibm_db -electron="18.0.0", there should not be any error. We have added prebuild windows binary for electron 18 to 24 only. Thanks.

orizzontiholding commented 1 year ago

@orizzontiholding Would you be able to use the newer version of electron? If you install ibm_db using npm i ibm_db -electron="18.0.0", there should not be any error. We have added prebuild windows binary for electron 18 to 24 only. Thanks.

At the moment the "vue-cli-plugin-electron-builder": "^2.1.1" will install electron 13, not sure if I can update it with the latest version. I'm having also trouble if I use node 18 that is installed in my system, for this project I'm running node 16 that is instelled as a dependency of the electron app. I need to investigate a bit about electron update

bimalkjha commented 1 year ago

@orizzontiholding If you can't update electron version, then you need to install older version of ibm_db. Please install ibm_db using command npm i ibm_db@2.8.2 -electron="13.0.0" and it should work fine. Thanks.

bimalkjha commented 1 year ago

@orizzontiholding Let me know if we can close this issue now. Thanks.

orizzontiholding commented 1 year ago

@bimalkjha Hi! We can consider the issue soilved, after I've updated electron builder to latest version and electron the library worked correctly and as is mentioned in another issue, the problem I'm having now is only for the licence. We are on an ibm i series db2 instance so I will try to find a solution to connect with the system. Thank you for the help