Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Cannot use IBMDB2 with ELECTRON #881

Closed
markddrake opened this issue Aug 23, 2022 · 7 comments
Closed

Bug Report: Cannot use IBMDB2 with ELECTRON #881

markddrake opened this issue Aug 23, 2022 · 7 comments

Comments

@markddrake
Copy link

Attemptng to use idbm2 with electron results in.

> yadamu@1.0.0 start
> electron ./


(node:39160) UnhandledPromiseRejectionWarning: Error: The module '\\?\C:\Development\YADAMU-GUI\src\node_modules\ibm_db\build\Release\odbc_bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 102. This version of Node.js requires
NODE_MODULE_VERSION 107. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1812)
    at Module._extensions..node (node:internal/modules/cjs/loader:1205:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1812)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at bindings (C:\Development\YADAMU-GUI\src\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> (C:\Development\YADAMU-GUI\src\node_modules\ibm_db\lib\odbc.js:57:31)
(Use `electron --trace-warnings ...` to show where the warning was created)
(node:39160) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

C:\Development\YADAMU-GUI>

Package.json

C:\Development\YADAMU-GUI>type src\package.json
{
  "name": "yadamu",
  "type": "module",
  "version": "1.0.0",
  "description": "User Interface for YADAMU",
  "main": "./node/gui/gui.cjs",
  "scripts": {
    "start": "electron ./"
  },
  "repository": {
    "type": "git",
    "url": "TBD"
  },
  "author": "Mark D Drake",
  "license": "SEE LICENSE IN TDB.txt",
  "dependencies": {
    "@azure/storage-blob": "12.8",
    "@electron/remote": "^2.0.8",
    "aws-sdk": "^2.731.0",
    "bootstrap": "^5.2.0",
    "bootstrap-icons": "^1.7.2",
    "cookie-parser": "^1.4.5",
    "csv-parser": "^3.0.0",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "font-awesome": "^4.7.0",
    "ibm_db": "^2.8.2",
    "install": "^0.13.0",
    "jquery": "^3.5.0",
    "mariadb": "^2.5.2",
    "mime-types": "^2.1.28",
    "mongodb": "^3.7.3",
    "mssql": "^7.3.0",
    "mysql": "^2.18.1",
    "npm": "^7.20.6",
    "oracledb": "^5.3.0",
    "pg": "^8.7.1",
    "pg-copy-streams": "^2.2.2",
    "pg-query-stream": "^4.2.1",
    "readable-stream": "^3.6.0",
    "snowflake-sdk": "^1.6.7",
    "teradata-nodejs-driver": "^1.0.0-rc.7",
    "uuid": "^8.0.0",
    "wkx": "^0.5.0"
  },
  "devDependencies": {
    "electron": "^20.0.3"
  }
}

C:\Development\YADAMU-GUI>
@markddrake markddrake changed the title Bug Report Bug Report: Cannot use IBMDB2 with ELECTRON Aug 23, 2022
@bimalkjha
Copy link
Member

@markddrake What is your version of electron and node.js? As per https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json , NODE_MODULE_VERSION 102 is for Node.js V17.x and 107 is for Electron 20.x.
If you are installing ibm_db for electron, then must use -vscode option as documented here: https://github.com/ibmdb/node-ibm_db . Just search for For ELECTRON or VSCode Installation to get right command.
Also, check this issue which is similar: https://stackoverflow.com/questions/73423890/electron-require-node-js-electron-node-module-version-107-no-corresponding-node
Thanks.

@bimalkjha
Copy link
Member

@markddrake Any update about this issue? Can we close it? Thanks.

@markddrake
Copy link
Author

Still can't get it to work

C:\Development\YADAMU-DB2\src>npm install ibm_db@latest -electron=20.1.0

up to date, audited 814 packages in 1s

45 packages are looking for funding
  run `npm fund` for details

5 vulnerabilities (1 low, 4 moderate)

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

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

Run `npm audit` for details.

C:\Development\YADAMU-DB2\src>type package.json
{
  "name": "yadamu",
  "type": "module",
  "version": "1.0.0",
  "description": "User Interface for YADAMU",
  "main": "./node/gui/gui.cjs",
  "scripts": {
    "start": "electron ./"
  },
  "repository": {
    "type": "git",
    "url": "TBD"
  },
  "author": "Mark D Drake",
  "license": "SEE LICENSE IN TDB.txt",
  "dependencies": {
    "@azure/storage-blob": "12.8",
    "@electron/remote": "^2.0.8",
    "aws-sdk": "^2.731.0",
    "bootstrap": "^5.2.0",
    "bootstrap-icons": "^1.7.2",
    "cookie-parser": "^1.4.5",
    "csv-parser": "^3.0.0",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "font-awesome": "^4.7.0",
    "ibm_db": "^2.8.2",
    "install": "^0.13.0",
    "jquery": "^3.5.0",
    "mariadb": "^2.5.2",
    "mime-types": "^2.1.28",
    "mongodb": "^3.7.3",
    "mssql": "^7.3.0",
    "mysql": "^2.18.1",
    "npm": "^8.18.0",
    "oracledb": "^5.3.0",
    "pg": "^8.7.1",
    "pg-copy-streams": "^2.2.2",
    "pg-query-stream": "^4.2.1",
    "readable-stream": "^3.6.0",
    "snowflake-sdk": "^1.6.13",
    "teradata-nodejs-driver": "^1.0.0-rc.7",
    "uuid": "^8.0.0",
    "wkx": "^0.5.0"
  },
  "devDependencies": {
    "electron": "^20.1.0"
  }
}

C:\Development\YADAMU-DB2\src>node -v
v17.7.2

C:\Development\YADAMU-DB2\src>cd ..

C:\Development\YADAMU-DB2>npm --prefix ./src start

> yadamu@1.0.0 start
> electron ./


(node:53472) UnhandledPromiseRejectionWarning: Error: The module '\\?\C:\Development\YADAMU-DB2\src\node_modules\ibm_db\build\Release\odbc_bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 102. This version of Node.js requires
NODE_MODULE_VERSION 107. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1812)
    at Module._extensions..node (node:internal/modules/cjs/loader:1205:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1812)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at bindings (C:\Development\YADAMU-DB2\src\node_modules\bindings\bindings.js:112:48)
    at Object.<anonymous> (C:\Development\YADAMU-DB2\src\node_modules\ibm_db\lib\odbc.js:57:31)
(Use `electron --trace-warnings ...` to show where the warning was created)
(node:53472) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

Also, when will the set of fixes/enhancements you checked in yesterday be availalbe in an NPM release?

@bimalkjha
Copy link
Member

@markddrake I am able to reproduce the issue. It is due to nan package. We can see the error message by running npm install -electron=20.1.0 command under C:\Development\YADAMU-DB2\src\node_modules\ibm_db\ directory. It throws same error as mentioned on this issue: nodejs/nan#942 and this issue: electron/electron#35193

To overcome it, you can use below commands:

npm uninstall ibm_db
npm install nan@github:jkleinsc/nan#remove_accessor_signature
npm install ibm_db@latest -electron=20.1.0

If you have msbuild.exe in your system, it should compile the native code well and fix the issue. Still you see the issue, we need to add precompiled binary for electron 20 in ibm_db which has binaries till electron 18 only.
You may add "nan": "github:jkleinsc/nan#remove_accessor_signature" in dependencies in your package.json file. If issue is not resolved, then cd C:\Development\YADAMU-DB2\src\node_modules\ibm_db\ and share complete output of npm install -electron=20.1.0 command.
We'll have new release of ibm_db soon in a week with all fixes. Thanks.

@markddrake
Copy link
Author

Will the new release include the electron changes ?. If so, if you don't mind I'll wait till I can pick it from the official NPM channel.

@bimalkjha
Copy link
Member

New release will have windows binary for electron 20. Thanks.

@bimalkjha
Copy link
Member

@markddrake A new version of ibm_db@3.0.0 is released. Just reinstall it using npm install ibm_db@latest -electron=20.1.0 and it should work now. Please verify. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants