Electron and sqlite3 issue after packaging app Electron and sqlite3 issue after packaging app angularjs angularjs

Electron and sqlite3 issue after packaging app


I've managed to fix this almost accidentally after bashing my head against my desk for a while. I was attempting to implement some logging to see whether there were issues with the node module not being recognised correctly when packaged, when I noticed the log file wasn't being created where I was expecting it to be - it was being created outside of the actual app directory and therefore was not accessible. The same thing happened with my database file.

See fix below:

var db = new sqlite3.Database(__dirname + '/app.db');

The addition of __dirname to the db file definition fixed the issue!