简体   繁体   English

如何在使用电子生成器构建 exe 后运行“sqlite3”

[英]How to 'sqlite3' run after build exe with electron-builder

I have build my electron app with help of https://medium.com/jspoint/packaging-and-distributing-electron-applications-using-electron-builder-311fc55178d9我在https://medium.com/jspoint/packaging-and-distributing-electron-applications-using-electron-builder-311fc55178d9的帮助下构建了我的 electron 应用程序

it was was success (windows only).这是成功的(仅限 Windows)。 but after install published app, i am getting error as shown in screenshort但在安装已发布的应用程序后,我收到错误,如 screenshort 所示

在此处输入图像描述

my scripts as below我的脚本如下

package.json 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": "shafeequeot@gmail.com",
  "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": {
   
  }
}

electron-builder.json电子制造商.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"
    }
}

can anybody help me to resolve this issue?有人可以帮我解决这个问题吗?

If sqlite3 is required during normal operation of your Electron application and not just during development then you will need to added sqlite3 as a dependency.如果在 Electron 应用程序的正常运行期间需要sqlite3而不仅仅是在开发期间,那么您需要添加sqlite3作为依赖项。

IE: Move "sqlite3": "^5.0.2" from "devDependencies": {... } to "dependencies": {... } . IE:将"sqlite3": "^5.0.2""devDependencies": {... }移动到"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": "shafeequeot@gmail.com",
  "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"   
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM