Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save maximilian-lindsey/9de273f72c1ba4aa62d6 to your computer and use it in GitHub Desktop.
Save maximilian-lindsey/9de273f72c1ba4aa62d6 to your computer and use it in GitHub Desktop.
SQLite3 Electron windows integration

SQLite3 Electron windows integration

This guide is based on the very informative discussion in this article: Using node_sqlite3 with Electron

Install sqlite3

npm install sqlite3 --save

Navigate into the sqlite3 module folder

cd node_modules/sqlite3

Install nan locally into the sqlite3 folder (you will need it for the next step)

npm install nan@~2.1.0 --save

Prebulish the module:

npm run prepublish

Start compilation by setting the module path to the correct version, in this case node-v47-win32-x64. It is located in your sqlite3 folder.

node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/node-v47-win32-x64

Finish compilation by setting your build to the correct target version. You will find the target version of your Electron-App in the version file in the root folder of your Electron directory.

node-gyp rebuild --target=0.36.0 --arch=x64 --target_platform=win32 --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/node-v47-win32-x64

Now you can use sqlite3 in your Electron app.

@Chelo21
Copy link

Chelo21 commented Apr 26, 2020

Solución: (electron y

npm install electron -save-dev
npm install electron-rebuild --save-dev
npm install sqlite3

en el "package.json" agregar:

"rebuild": "electron-rebuild -f -w sqlite3"

===================
npm run rebuild

=================
y listo.
Por las dudas en los ".js":
var sqlite3 = require('sqlite3').verbose();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment