0

我已经用 Angular 4 和 PouchDB 构建了一个 Electron 应用程序。当我应用程序时一切正常npm run start

但是,当我将应用程序捆绑到可执行文件并运行它时,PouchDB 无法正常工作。当我将应用程序捆绑到可执行文件时,如何使 PouchDB 与 Electron 和 Angular 4 一起使用?

我正在使用 Mac。

以下是我的 package.json 文件中的“脚本”:

"scripts": {
    "ng": "ng",
    "start": "npm run build.ng && npm run build.tasks && npm run build.electron && concurrently \"npm run start.server\" \"npm run start.electron\"",
    "start.server": "pouchdb-server -d ./.db",
    "start.watch": "npm run build.ng.watch",
    "start.electron": "electron dist/electron-app.js",
    "watch": "npm run build.tasks && npm run build.electron && npm run build.watch && npm run start.electron",
    "build": "ng build --base-href . && npm run build.electron",
    "build.prod": "ng build --prod --base-href . && npm run build.electron",
    "build.ng": "ng build --base-href .",
    "build.ng.watch": "ng build --base-href . --watch",
    "build.electron": "gulp build.electron",
    "build.tasks": "gulp build.tasks",
    "build.watch": "gulp build.default",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "bundle.clean": "gulp bundle.clean",
    "bundle.prepare": "npm run bundle.prepare.npm && npm run bundle.clean",
    "bundle.prepare.npm": "gulp build.npm.copy",
    "bundle.mac": "npm run bundle.prepare && electron-packager dist/ myapp --platform=darwin --arch=x64 --overwrite --out=bundles --prune=true",
    "bundle.windows": "npm run bundle.prepare && electron-packager dist/ myapp --platform=win32 --overwrite --out=bundles --prune=true",
    "bundle.linux": "npm run bundle.prepare && electron-packager dist/ myapp --platform=linux --overwrite --out=bundles --prune=true",
    "electron-packager": "electron-packager"
  }

要为 mac 捆绑 Electron 应用程序,我运行命令npm run bundle.mac

4

0 回答 0