Make Electron Work with Sqlite3

Posted by in Software, Tutorial

The other day I tried to integrate knex with a SQLITE3 back-end. Unfortunately, the instant I’ve tried to instantiate knex, I’ve got a lot of errors. After getting rid of them, I found that I can’t get sqlite3 to work at all, even though I’ve checked the installation and it was OK (got the binary downloaded and even rebuilt it).

Uncaught Error: Cannot find module ‘/…/node_modules/sqlite3/lib/binding/node-v51-darwin-x64/node_sqlite3.node’

So, here are the steps that I did to make it work:

  1. install electron-rebuild

  2. install sqlite3 using npm

  3. rebuild electron with sqlite3. In package.json scripts section, add:

  4. run the following command

Now, you’ll get another binding, something like:

which is accepted by electron.


A little experiment: If you find this post and ad below useful, please check the ad out :-)