我使用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