• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

276
Views
Error: SQLITE_CANTOPEN: unable to open database file with electron-forge packed app

I'm using a sqlite database called sqlite.db in my app. The database is located in the top directory of my app.

I test the app with npm start while developing. While testing, the database works fine.

After creating the app via npm run make (electron-forge), the database cannot be accessed with the following error: SQLITE_CANTOPEN: unable to open database file with electron-forge.

  • My first thought was a wrong directory in the code, but that doesn't seem to be the issue after all.
  • Also the database itself is available in the packed application.
  • And it doesn't seem to be a code issue as texting works fine:
    const sqlite3 = require('sqlite3');
    const { open } = require('sqlite');
    sqlite3.verbose();
    return open({
        filename,                    //filename='./sqlite.db' (actually a path)
        driver: sqlite3.Database
    });

This brings me to the conclusion, something must be wrong in the configuration for the app-building process via Electron Forge. But I have no clue if that assumption is correct - and if so, how to do that.

The closest I found to a fix was this similar issue but with Electron Builder - since I use Electron Forge, I wasn't able to apply the suggested solution 1:1...

about 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error