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
drizzle-kit push:sqlite
drizzle-kit push:sqlite
I get:
better_sqlite3.node was compiled against a different Node.js version using NODE_MODULE_VERSION 119. This version of Node.js requires NODE_MODULE_VERSION 120. Please try re-compiling or re-installing the module.
better_sqlite3.node was compiled against a different Node.js version using NODE_MODULE_VERSION 119. This version of Node.js requires NODE_MODULE_VERSION 120. Please try re-compiling or re-installing the module.
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
Chris P Bacon
Chris P Bacon9mo ago
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.
yunhao
yunhao6mo ago
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 ...
Want results from more Discord servers?
Add your server