繁体   English   中英

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

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

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

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

在此处输入图像描述

我的脚本如下

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": {
   
  }
}

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

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

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

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