gpt4 book ai didi

electron - 使用 Electron 生成器打包应用程序后无法打开 Electron 应用程序

转载 作者:行者123 更新时间:2023-12-03 12:37:40 25 4
gpt4 key购买 nike

使用 Electron 生成器构建 Electron 应用程序后,我无法从dist文件夹中打开该应用程序。我确实更改了所有链接以使用path.join(__ dirname,“relative_path/”),正如我在此处的某些答案中所看到的那样。但是,即使打包过程成功了,我也无法打开应用程序。
File structure for the electron app project
这是我的file structure的图像,这是项目的package.json文件

{
"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"
}
}
最后,如果此处的信息不够,这是到存储库的链接 https://github.com/Leonlit/My-Little-Reminder/tree/development

最佳答案

通过添加和使用npm脚本"postinstall": "electron-builder install-app-deps"解决了该问题。
然后,为sqlite数据库存储位置使用path.join(app.getPath('userData'), '/tasks.db')而不是path.join(__dirname, '/tasks.db')
最后,更改了索引文件中的链接,这导致应用程序始终处于未启动状态,因此始终在应用程序启动时请求保存ASAR文件。

关于electron - 使用 Electron 生成器打包应用程序后无法打开 Electron 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65895747/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com