1

I want to update better-sqlite3 in my Electron App. Because of some lags between Nodejs, Electron and better-sqlit3 releases, I need to manually install better-sqlite3 with this command :

npm install better-sqlite3@latest --build-from-source --sqlite3="$(pwd)/sqlite-amalgamation"

I'm using Node.js v18.9.0, so the ABI number is 108, therefore the better-sqlite3 compilation shall produce node_module_version=108.

But, according to https://github.com/electron/releases, it looks like I can't get Electron releases with and ABI=108.

Then, I end up with this error :

Failed to initialize Database ... : Error: The module '...node_modules/better-sqlite3/build/Release/better_sqlite3.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 108. 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).

Obviously, npm rebuild or npm install did not work. Neither following workarounds, since the better-sqlite3 has to be built a part, using node-gyp that depends on my Node version (with ABI=108).

https://stackoverflow.com/questions/41131312/electron-rebuild-building-wrong-version-of-node-sqlite3

Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51 https://stackoverflow.com/questions/41131312/electron-rebuild-building-wrong-version-of-node-sqlite3

Using node module node-abi, I got below numbers. Furthermore, according to https://www.electronjs.org/releases/stable, Electron 20.0.0 depends on Node 16.15.0, which an even lower ABI number.

So, I would like to know, if there is any way to get an Electron build with the ABI I want? Or how to build Electron by myself ? Thanks

109   electron   21.0.0-alpha.1
108   node   18.0.0
107   electron   20.0.0-alpha.1
106   electron   19.0.0-alpha.1
103   electron   18.0.0-alpha.1
102   node   17.0.0
101   electron   17.0.0-alpha.1
099   electron   16.0.0-alpha.1
098   electron   15.0.0-beta.7
097   electron   14.0.2
093   node   16.0.0
089   electron   15.0.0-alpha.1
089   electron   14.0.0-beta.1
089   electron   13.0.0-beta.2
088   node   15.0.0
087   electron   12.0.0-beta.1
085   electron   11.0.0-beta.11
083   node   14.0.0
...

1 Answer 1

0
> cd better-sqlite3
> node-gyp rebuild --release --target=15.3.0  --dist-url=https://electronjs.org/headers

[electron version] [15.3.0,19.0.1] is ok

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.