-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Binaries reported as wrong version inside Electron 31 #1203
Comments
If you check the pinned Electron installation help topic, #126, there should be tips there, but I'm currently using https://github.com/electron/packager (in concert with https://www.electronforge.io/) to manage the native library rebuilds. Also: Electron v31 isn't supported yet -- it just came out a day ago, and the new version of v8 deleted previously-working code (hence #1200). Try with Electron v30 until the next release is out. |
Thanks so much for the reply! I removed everything but the 2 sample files, changed the dev dependency to The advice was to use this command to rebuild When I run that command it gives me a green checkmark followed by "Rebuild complete" yet the app produces the same error. There is a lot of stuff to wade through before the comment I linked and nothing related to a vanilla Electron setup in any of the following comments so I'm looking for direction. I know the issue here is tied to the Node and Electron versions. Since I cannot regress Node because of other projects is there a Electron version that the current release is known to work on using the pre-built binary archives? The latest version I see is Electron 23 which is a major step back unless those are just meant for people not using Electron 30. Since the rebuild is successful as far as it's concerned one other thing people have mentioned is the |
There are prebuilt binaries of better-sqlite3 11.0.0 available for Electron v30 (module version 123) aswell as Node v22 (module version 127). There is nothing you can control by modifying the binding.gyp. This is more or less just the common compiler settings for the overall project not related to any Node / Electron version. The actual used API header files etc. are passed on from "the outside" by the respective toolchain (node-gyp, prebuilt, electron-rebuild ..). When it comes to your project setup, you have to decide whether to use Node or Electron as a runtime, but you cannot implement the application with Electron as a target runtime and Node as a runtime to run tests in, if you do not also take care about loading / rebuilding the fitting binary beforehand. If your goal is to develop an Electron application and to write tests for it, I would recommend to utilize a library like https://github.com/jprichardson/electron-mocha which allows you to also run tests within the very same Electron runtime your application will be using. |
I now understand the separation of Node/Electron for the binaries. My problem remains the fact that the basic |
That would be this archive better-sqlite3-v11.0.0-electron-v123-win32-x64.tar.gz. You could then either drop the file in node_modules/better-sqlite3/build/release or store it in a custom location and pass the actual path to the better_sqlite3.node file using the nativeBinding option of the Database constructor. |
Awesome, thanks so much! And now I know the process for future builds when new versions of Electron are supported! |
Howdy!
Love your library, it's been great to work with.
I have been developing an app originally just in Node that I am incorporating into Electron. If I access
better-sqlite3
from a utility file, say,node dbtest.js
, everything works fine. Unfortunately the exact same code inside Electron produces this:As I mentioned there is no problem executing as Node itself but in case it matters here are my version numbers:
node: 22.3.0
electron: 31.0.0
better-sqlite3: 11.0.0
I'm assuming this is an Electron problem but looking for any solution as I cannot continue development until I get past this.
Thanks for any advice,
Chris
P.S. I don't know if it's an extension I have installed or a normal feature but inside VSCode next to each non-internal library I require it shows me a size such as for Electron it shows
const { app, BrowserWindow, ipcMain, shell } = require('electron') 267 (gzipped: 209)
but I don't get that info on theconst Database = require('better-sqlite3')
line.P.P.S. I have tried all the "solutions" mentioned in other issues using
electron-rebuild
(which is deprecated) and it's replacement module@electron/rebuild
both of which install with loads of issues, declare rebuild was successful, yet change nothing.P.P.P.S. I have created a minimal example based on this previous issue comment: #1111 (comment)
Mine is not a global Electron install so it's different than the linked issue. Still produces the same error as in my full app.
The text was updated successfully, but these errors were encountered: