Sqlite3 in Electron wrapper

  • Hi all,
    after having solved some problems with the initial Electron configuration , I am now stuck into making Sqlite work.
    I managed to install it and recompile it, it even works in the main Process but it doesn’t in the Renderer process files (i.e. the Vue Components).

    I first tried simply installing Sqllite with:

    1. npm install electron-rebuild --save-dev
    2. npm install sqlite3 --save-dev
    3. electron-rebuild -f -w sqlite3

    then I tried with the steps described here and the following postinstall script
    cd node_modules/sqlite3 && npm install nan && npm run prepublish && node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/node-v48-linux-x64 && node-gyp rebuild --target=1.6.2 --arch=x64 --target_platform=linux --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.6-linux-x64

    but the result is always the same: it works in the main Process, but when I try to require Sqlite through const sqlite3 = require('sqlite3').verbose() in the Rendered process I get

    ERROR in ./~/sqlite3/lib/sqlite3.js
    Module not found: Error: Can't resolve 'node-pre-gyp' in '/home/....../node_modules/sqlite3/lib'
     @ ./~/sqlite3/lib/sqlite3.js 1:13-36

    but node-pre-gyp is correctly installed under the node_modules/sqlite3/node_modules folder . Furthermore manually installing it does not help.

    Any suggestion?

    There is this minimal working boilerplate but I fear it does not help us.

    Another useful guide that I in vain followed

  • Hi @Michele-Angioni , did you get to run sqlite with electron?

Log in to reply