如何在使用 Electron-builder 构建 exe 后运行“sqlite3”

2023-11-30

我在以下人员的帮助下构建了我的电子应用程序https://medium.com/jspoint/packaging-and-distributing-electron-applications-using-electron-builder-311fc55178d9

这是成功的(仅限Windows)。但安装发布的应用程序后,我收到错误,如屏幕截图所示

enter image description here

我的脚本如下

包.json

  "name": "aux-services",
  "version": "1.0.0",
  "description": "Mobile Repair Tracking System",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "postinstall": "electron-builder install-app-deps",
      "pack": "electron-builder -w"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/shafeequeot/Mobile-Service-Tracker.git"
  },
  "author": "AuxWall",
  "email": "[email protected]",
  "url": "https://auxwall.com",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/shafeequeot/Mobile-Service-Tracker/issues"
  },
  "homepage": "https://github.com/shafeequeot/Mobile-Service-Tracker#readme",
  "devDependencies": {
    "electron": "^11.1.1",
    "electron-builder": "^22.14.13",
    "sqlite3": "^5.0.2"
  },
  "dependencies": {
   
  }
}

电子构建器.json

{
    "appId": "com.auxWall.service",

    "productName": "Aux Services",
    "copyright": "AuxWall",
    "directories": {
        "app": ".",
        "output": "out",
        "buildResources": "build-res"
    },
    "files": [
        "package.json",
        "**/*",
        "node_modules"
    ],
    "dmg": {
        "background": null,
        "backgroundColor": "#ffffff",
        "window": {
            "width": "400",
            "height": "300"
        },
        "contents": [
            {
                "x": 100,
                "y": 100
            },
            {
                "x": 300,
                "y": 100,
                "type": "link",
                "path": "/Applications"
            }
        ]
    },
    "mac": {
        "target": "dmg",
        "category": "public.auxWall.services"
      },
    "win": {
        "target": "nsis"
    },
    "linux": {
        "target": "AppImage",
        "category": "Utility"
    }
}

有人可以帮我解决这个问题吗?


If sqlite3在 Electron 应用程序的正常操作期间需要,而不仅仅是在开发期间,那么您需要添加sqlite3作为依赖。

即:移动"sqlite3": "^5.0.2" from "devDependencies": { ... } to "dependencies": { ... }.

package.json

{
  "name": "aux-services",
  "version": "1.0.0",
  "description": "Mobile Repair Tracking System",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "postinstall": "electron-builder install-app-deps",
      "pack": "electron-builder -w"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/shafeequeot/Mobile-Service-Tracker.git"
  },
  "author": "AuxWall",
  "email": "[email protected]",
  "url": "https://auxwall.com",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/shafeequeot/Mobile-Service-Tracker/issues"
  },
  "homepage": "https://github.com/shafeequeot/Mobile-Service-Tracker#readme",
  "devDependencies": {
    "electron": "^11.1.1",
    "electron-builder": "^22.14.13"
  },
  "dependencies": {
    "sqlite3": "^5.0.2"   
  }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在使用 Electron-builder 构建 exe 后运行“sqlite3” 的相关文章

随机推荐