Problem with electron and drizzle-kit push
Hey. I am using electron with better-sqlite3 and drizzle.
For better-sqlite3 to be able to work with electron, it has to be built for it. I build it and I can use drizzle to generate schemas and write statements, for example (create user) and the app works fine.
However, when I try to run
I get:
It seems that somehow my setup is mismatching my node versions or something.
If I manually go to my better-sqlite3 node module folder and build it, I can run drizzle-kit push:sqlite with no problems. However my app won't launch anymore after that and gives me the exact same node_module_version mismatch problem. It just seems like some weird compile/package/version mismatching problem and I have no clue at this point.
2 Replies
I've been fighiting the same issue. Even if I rebuild (npm rebuild better-sqlite3), as everyone suggests, I still get the error.
Althoug in my case, I'm trying to execute a script to run migrations.
It’s because there are two node.js runtimes when developing an Electron project. The electron app runs better-sqlite3 with its bundled node. However, drizzle-kit cli runs better-sqlite3 with the node installed on your system(macOS/Windows/Linux)
see: https://github.com/WiseLibs/better-sqlite3/issues/1171
GitHub
Using drizzle-kit with better-sqlite3 in an electron application · ...
Hey For me, drizzle-orm and better-sqlite3 work without problems in my electron-app. However, the drizzle-kit gives the NODE_MODULE_VERSION error. I guess this is because drizzle-kit does not work ...