0
votes

After building the electron application using electron-builder, I cannot open the application from the dist folder. I did change all my links to use path.join(__dirname, "relative_path/") as what I have seen in some answers here. But I can't open the application even though the packaging process is successful.

File structure for the electron app project

Here's an image of my file structure, and this is the package.json file of the project

{
  "name": "my_little_reminder",
  "version": "0.5.0",
  "description": "A simple time reminder app",
  "main": "src/index.js",
  "scripts": {
    "start": "electron .",
    "test": "jest --coverage",
    "build": "electron-builder --dir"
  },
  "author": "Leonlit",
  "license": "MIT",
  "dependencies": {
    "node-notifier": ">=8.0.1",
    "node-schedule": "^1.3.2",
    "sqlite3": "^5.0.0",
    "electron-log": "^4.3.1"
  },
  "devDependencies": {
    "electron": "^11.2.1",
    "electron-builder": "^22.9.1",
    "jest": "^26.6.3"
  }
}

Finally, here's a link to the repository if the information here is not enough, https://github.com/Leonlit/My-Little-Reminder/tree/development

1

1 Answers

0
votes

Resolved the issue by adding and using the npm script "postinstall": "electron-builder install-app-deps".

Then, using path.join(app.getPath('userData'), '/tasks.db') instead of path.join(__dirname, '/tasks.db') for the sqlite database storage location.

Finally, changed a link in the index file which caused the application to always request for saving a ASAR file on app launch if left unfixed.