Make Electron Work with Sqlite3
1 min read

Make Electron Work with Sqlite3

Make Electron Work with Sqlite3

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

    npm install --save-dev electron-rebuild
  2. install sqlite3 using npm

    npm install --save sqlite3
  3. rebuild electron with sqlite3. In package.json scripts section, add:

    "rebuild": "electron-rebuild -f -w sqlite3"
  4. run the following command

    npm run rebuild

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


which is accepted by electron.