How to use SQLite with electron

February 25, 2020

How to use sqlite with electron

By far the easiest way to use SQLite with electron is withelectron-builder.

First, add a postinstall step in your package.json

"scripts": {
   "postinstall": "install-app-deps"
   ...
}

and then install the necessary dependencies and build:

npm install --save-dev electron-builder
npm install --save sqlite3
npm run postinstall

electron-builder will build the native module for your platform, with the correct name for the Electron binding; and you can then requireit in code as normal.


Written by Manoj Bhardwaj who lives and works in Mohali Punjab (India). My stackoverflow