我们正在努力为Windows 32位和64位构建应用程序。
使用sqlite3作为数据库的角度2应用程序。
在开发过程中,一切都运行良好,但在打包应用程序并在Windows上运行后,它会抛出错误
SQLite package has not been found installed. Try to install it: npm install sqlite3 --save
这是package.json(对于这个问题很重要的一部分):
"scripts": {
"build:aot:prod": "npm run clean:dist && npm run clean:aot && cross-env BUILD_AOT=1 npm run webpack -- --config config/webpack.prod.js --progress --profile --bail",
"build:aot": "npm run build:aot:prod",
"build:dev": "npm run clean:dist && npm run webpack -- --config config/webpack.dev.js --progress --profile",
"build:docker": "npm run build:prod && docker build -t angular2-webpack-start:latest .",
"build:prod": "npm run clean:dist && npm run webpack -- --config config/webpack.prod.js --progress --profile --bail",
"build": "npm run build:dev",
"ci:aot": "npm run lint && npm run test && npm run build:aot && npm run e2e",
"ci:jit": "npm run lint && npm run test && npm run build:prod && npm run e2e",
"ci:nobuild": "npm run lint && npm test && npm run e2e",
"ci:testall": "npm run lint && npm run test && npm run build:prod && npm run e2e && npm run build:aot && npm run e2e",
"ci:travis": "npm run lint && npm run test && npm run build:aot && npm run e2e:travis",
"ci": "npm run ci:testall",
"clean:dll": "npm run rimraf -- dll",
"clean:aot": "npm run rimraf -- compiled",
"clean:dist": "npm run rimraf -- dist",
"clean:install": "npm set progress=false && npm install",
"clean": "npm cache clean --force && npm run rimraf -- node_modules doc coverage dist compiled dll",
"docker": "docker",
"docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/",
"e2e:live": "npm-run-all -p -r server:prod:ci protractor:live",
"e2e:travis": "npm-run-all -p -r server:prod:ci protractor:delay",
"e2e": "npm-run-all -p -r server:prod:ci protractor",
"github-deploy:dev": "npm run webpack -- --config config/webpack.github-deploy.js --progress --profile --env.githubDev",
"github-deploy:prod": "npm run webpack -- --config config/webpack.github-deploy.js --progress --profile --env.githubProd",
"github-deploy": "npm run github-deploy:dev",
"lint": "npm run tslint \"src/**/*.ts\"",
"node": "node",
"postinstall": "install-app-deps && electron-rebuild",
"postversion": "git push && git push --tags",
"preclean:install": "npm run clean",
"preversion": "npm test",
"protractor": "protractor",
"protractor:delay": "sleep 3 && npm run protractor",
"protractor:live": "protractor --elementExplorer",
"rimraf": "rimraf",
"server:dev:hmr": "npm run server:dev -- --inline --hot",
"server:dev": "npm run webpack-dev-server -- --config config/webpack.dev.js --progress --profile --watch --content-base src/",
"server:prod": "http-server dist -c-1 --cors",
"server:prod:ci": "http-server dist -p 3000 -c-1 --cors",
"server": "npm run server:dev",
"start:hmr": "npm run server:dev:hmr",
"start": "npm run server:dev",
"test": "npm run lint && karma start",
"tslint": "tslint",
"typedoc": "typedoc",
"version": "npm run build",
"watch:dev:hmr": "npm run watch:dev -- --hot",
"watch:dev": "npm run build:dev -- --watch",
"watch:prod": "npm run build:prod -- --watch",
"watch:test": "npm run test -- --auto-watch --no-single-run",
"watch": "npm run watch:dev",
"electron:pre": "copyfiles main.js dist && copyfiles package.json dist && copyfiles ./icons/* ./dist && npm --prefix ./dist install ./dist --production",
"electron:dev": "cross-env NODE_ENV=development electron .",
"electron:prod": "npm run build:aot:prod && npm run electron:pre && electron ./dist",
"electron:linux": "npm run build:aot:prod && npm run electron:pre && node package.js --asar --platform=linux --arch=x64 && cd dist && electron-builder install-app-deps --platform=linux --arch=x64",
"electron:windows": "npm run build:aot:prod && npm run electron:pre && electron-builder install-app-deps --platform=win32 && node package.js --asar --platform=win32",
"electron:mac": "npm run build:aot:prod && npm run electron:pre && node package.js --asar --platform=darwin --arch=x64 && cd dist && electron-builder install-app-deps --platform=darwin --arch=x64",
"webdriver-manager": "webdriver-manager",
"webdriver:start": "npm run webdriver-manager start",
"webdriver:update": "webdriver-manager update",
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"
},
"dependencies": {
"node-pre-gyp": "^0.6.38",
"sqlite3": "^3.1.9",
"typeorm": "0.1.0-alpha.49",
"uikit": "^3.0.0-beta.30"
},
"devDependencies": {
"@angular/animations": "~4.3.1",
"@angular/common": "~4.3.1",
"@angular/compiler": "~4.3.1",
"@angular/compiler-cli": "~4.3.1",
"@angular/core": "~4.3.1",
"@angular/forms": "~4.3.1",
"@angular/http": "~4.3.1",
"@angular/platform-browser": "~4.3.1",
"@angular/platform-browser-dynamic": "~4.3.1",
"@angular/platform-server": "~4.3.1",
"@angular/router": "~4.3.1",
"@angularclass/hmr": "~1.2.2",
"@angularclass/hmr-loader": "^3.0.4",
"@ngrx/effects": "^4.0.5",
"@ngrx/store": "^4.0.3",
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "2.5.45",
"@types/node": "^7.0.39",
"@types/source-map": "^0.5.0",
"@types/uglify-js": "^2.6.28",
"@types/webpack": "^2.2.16",
"add-asset-html-webpack-plugin": "^1.0.2",
"angular2-template-loader": "^0.6.2",
"assets-webpack-plugin": "^3.5.1",
"awesome-typescript-loader": "~3.1.2",
"codelyzer": "~2.1.1",
"copy-webpack-plugin": "^4.0.1",
"copyfiles": "^1.2.0",
"core-js": "^2.4.1",
"cross-env": "^5.0.0",
"css-loader": "^0.28.0",
"electron": "1.7.5",
"electron-builder": "^19.27.7",
"electron-packager": "8.7.2",
"electron-rebuild": "^1.6.0",
"electron-reload": "^1.1.0",
"exports-loader": "^0.6.4",
"expose-loader": "^0.7.3",
"extract-text-webpack-plugin": "~2.1.0",
"file-loader": "^0.11.1",
"find-root": "^1.0.0",
"gh-pages": "^1.0.0",
"html-webpack-plugin": "^2.28.0",
"http-server": "^0.9.0",
"ie-shim": "^0.1.0",
"imports-loader": "^0.7.1",
"inline-manifest-webpack-plugin": "^3.0.1",
"istanbul-instrumenter-loader": "2.0.0",
"jasmine-core": "^2.5.2",
"jquery": "^3.2.1",
"karma": "^1.6.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.1.0",
"karma-mocha-reporter": "^2.2.3",
"karma-remap-coverage": "^0.1.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.4",
"less": "^2.7.2",
"less-loader": "^4.0.5",
"ng-router-loader": "^2.1.0",
"ngc-webpack": "^3.2.0",
"node-sass": "^4.5.2",
"npm-run-all": "^4.0.2",
"optimize-js-plugin": "0.0.4",
"parse5": "^3.0.2",
"preload-webpack-plugin": "^1.2.2",
"protractor": "^5.1.1",
"raw-loader": "0.5.1",
"reflect-metadata": "^0.1.10",
"rimraf": "~2.6.1",
"rxjs": "~5.0.2",
"sass-loader": "^6.0.3",
"script-ext-html-webpack-plugin": "^1.8.5",
"source-map-loader": "^0.2.1",
"string-replace-loader": "~1.2.0",
"style-loader": "^0.18.1",
"to-string-loader": "^1.1.5",
"ts-node": "^3.3.0",
"tslib": "^1.7.1",
"tslint": "~4.5.1",
"tslint-loader": "^3.5.2",
"typedoc": "^0.7.1",
"typescript": "2.5.0",
"uglify-js": "git://github.com/mishoo/UglifyJS2#harmony-v2.8.22",
"uglifyjs-webpack-plugin": "0.4.3",
"url-loader": "^0.5.8",
"webpack": "~2.6.1",
"webpack-dev-middleware": "^1.10.1",
"webpack-dev-server": "~2.4.2",
"webpack-dll-bundles-plugin": "^1.0.0-beta.5",
"webpack-merge": "~4.1.0",
"zone.js": "0.8.14"
},
运行npm run electron:windows
后,一切都很好,输出结果为:
/home/haris/.nvm/versions/node/v6.9.4/bin/node /home/haris/.nvm/versions/node/v6.9.4/lib/node_modules/npm/bin/npm-cli。 js run electron:windows --scripts-prepend-node-path = auto
> angular-electron-starter@1.0.0 electron:windows /home/haris/development/walter/bitbucket-
> npm run build:aot:prod && npm run electron:pre && electron-builder install-app-deps --platform=win32 && node package.js --asar --platform=win32
> angular-electron-starter@1.0.0 build:aot:prod /home/haris/development/walter/bitbucket-
> npm run clean:dist && npm run clean:aot && cross-env BUILD_AOT=1 npm run webpack -- --config config/webpack.prod.js --progress --profile --bail
> angular-electron-starter@1.0.0 clean:dist /home/haris/development/walter/bitbucket-
> npm run rimraf -- dist
> angular-electron-starter@1.0.0 rimraf /home/haris/development/walter/bitbucket-
> rimraf "dist"
> angular-electron-starter@1.0.0 clean:aot /home/haris/development/walter/bitbucket-
> npm run rimraf -- compiled
> angular-electron-starter@1.0.0 rimraf /home/haris/development/walter/bitbucket-
> rimraf "compiled"
> angular-electron-starter@1.0.0 webpack /home/haris/development/walter/bitbucket-
> node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "config/webpack.prod.js" "--progress" "--profile" "--bail"
Starting compilation using the angular compiler.
Angular compilation done, starting webpack bundling.
0% compiling
10% building modules 0/1 modules 1 active ...ntent-manager/src/main.browser.aot.ts
10% building modules 0/2 modules 2 active ...tent-manager/src/polyfills.browser.ts
[at-loader] Using typescript@2.5.0 from typescript and "tsconfig.json" from /home/haris/development/walter/bitbucket-/tsconfig.webpack.json.
10% building modules 1/2 modules 1 active ...tent-manager/src/polyfills.browser.ts
# I removed building modules proccess because of limit of characters on stackoverflow.
25067ms additional asset processing
92% chunk asset optimization
3538ms chunk asset optimization
94% asset optimization
[at-loader] Checking started in a separate process...
[at-loader] Ok, 2.38 sec.
2788ms asset optimization
95% emitting
18ms emitting
Hash: a3f29d769fb284afcae1
Version: webpack 2.6.1
Time: 62001ms
[emitted]
WARNING in ./~/typeorm/platform/PlatformTools.js
33:19-32 Critical dependency: the request of a dependency is an expression
WARNING in ./~/typeorm/platform/PlatformTools.js
37:23-85 Critical dependency: the request of a dependency is an expression
Child html-webpack-plugin for "index.html":
[3IRH] (webpack)/buildin/module.js 517 bytes {0} [built]
[] -> factory:36ms building:174ms = 210ms
[7GO9] ./~/html-webpack-plugin/lib/loader.js!./src/index.html 2.2 kB {0} [built]
factory:6ms building:11ms = 17ms
[DuR2] (webpack)/buildin/global.js 509 bytes {0} [built]
[] -> factory:36ms building:174ms = 210ms
[M4fF] ./~/lodash/lodash.js 540 kB {0} [built]
[] -> factory:83ms building:3556ms = 3639ms
Child extract-text-webpack-plugin:
[9rjH] ./~/css-loader!./src/styles/headings.css 166 bytes {0} [built]
factory:2ms building:17ms = 19ms
[FZ+f] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
[] -> factory:0ms building:2ms = 2ms
Child extract-text-webpack-plugin:
[FZ+f] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
[] -> factory:0ms building:1ms = 1ms
[pZge] ./~/css-loader!./~/less-loader/dist/cjs.js!./src/styles/styles.less 256 kB {0} [built]
factory:3ms building:5063ms = 5066ms
> angular-electron-starter@1.0.0 electron:pre /home/haris/development/walter/bitbucket-
> copyfiles main.js dist && copyfiles package.json dist && copyfiles ./icons/* ./dist && npm --prefix ./dist install ./dist --production
> sqlite3@3.1.13 install /home/haris/development/walter/bitbucket-/dist/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
[sqlite3] Success: "/home/haris/development/walter/bitbucket-/dist/node_modules/sqlite3/lib/binding/node-v48-linux-x64/node_sqlite3.node" is installed via remote
> angular-electron-starter@1.0.0 postinstall /home/haris/development/walter/bitbucket-/dist
> install-app-deps && electron-rebuild
Warning: Please use as subcommand: electron-builder install-app-deps
electron-builder 19.36.0
Rebuilding native production dependencies for linux:x64
✔ Rebuild Complete
angular-electron-starter@1.0.0 /home/haris/development/walter/bitbucket-/dist
├─┬ node-pre-gyp@0.6.38
│ ├─┬ hawk@3.1.3
│ │ ├── boom@2.10.1
│ │ ├── cryptiles@2.0.5
│ │ ├── hoek@2.16.3
│ │ └── sntp@1.0.9
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ ├─┬ nopt@4.0.1
│ │ ├── abbrev@1.1.1
│ │ └─┬ osenv@0.1.4
│ │ ├── os-homedir@1.0.2
│ │ └── os-tmpdir@1.0.2
│ ├─┬ npmlog@4.1.2
│ │ ├─┬ are-we-there-yet@1.1.4
│ │ │ └── delegates@1.0.0
│ │ ├── console-control-strings@1.1.0
│ │ ├─┬ gauge@2.7.4
│ │ │ ├── aproba@1.2.0
│ │ │ ├── has-unicode@2.0.1
│ │ │ ├── object-assign@4.1.1
│ │ │ ├── signal-exit@3.0.2
│ │ │ ├─┬ string-width@1.0.2
│ │ │ │ ├── code-point-at@1.1.0
│ │ │ │ └─┬ is-fullwidth-code-point@1.0.0
│ │ │ │ └── number-is-nan@1.0.1
│ │ │ ├─┬ strip-ansi@3.0.1
│ │ │ │ └── ansi-regex@2.1.1
│ │ │ └── wide-align@1.1.2
│ │ └── set-blocking@2.0.0
│ ├─┬ rc@1.2.1
│ │ ├── deep-extend@0.4.2
│ │ ├── ini@1.3.4
│ │ ├── minimist@1.2.0
│ │ └── strip-json-comments@2.0.1
│ ├─┬ request@2.81.0
│ │ ├── aws-sign2@0.6.0
│ │ ├── aws4@1.6.0
│ │ ├── caseless@0.12.0
│ │ ├─┬ combined-stream@1.0.5
│ │ │ └── delayed-stream@1.0.0
│ │ ├── extend@3.0.1
│ │ ├── forever-agent@0.6.1
│ │ ├─┬ form-data@2.1.4
│ │ │ └── asynckit@0.4.0
│ │ ├─┬ har-validator@4.2.1
│ │ │ ├─┬ ajv@4.11.8
│ │ │ │ ├── co@4.6.0
│ │ │ │ └─┬ json-stable-stringify@1.0.1
│ │ │ │ └── jsonify@0.0.0
│ │ │ └── har-schema@1.0.5
│ │ ├─┬ http-signature@1.1.1
│ │ │ ├── assert-plus@0.2.0
│ │ │ ├─┬ jsprim@1.4.1
│ │ │ │ ├── assert-plus@1.0.0
│ │ │ │ ├── extsprintf@1.3.0
│ │ │ │ ├── json-schema@0.2.3
│ │ │ │ └─┬ verror@1.10.0
│ │ │ │ └── assert-plus@1.0.0
│ │ │ └─┬ sshpk@1.13.1
│ │ │ ├── asn1@0.2.3
│ │ │ ├── assert-plus@1.0.0
│ │ │ ├── bcrypt-pbkdf@1.0.1
│ │ │ ├─┬ dashdash@1.14.1
│ │ │ │ └── assert-plus@1.0.0
│ │ │ ├── ecc-jsbn@0.1.1
│ │ │ ├─┬ getpass@0.1.7
│ │ │ │ └── assert-plus@1.0.0
│ │ │ ├── jsbn@0.1.1
│ │ │ └── tweetnacl@0.14.5
│ │ ├── is-typedarray@1.0.0
│ │ ├── isstream@0.1.2
│ │ ├── json-stringify-safe@5.0.1
│ │ ├─┬ mime-types@2.1.17
│ │ │ └── mime-db@1.30.0
│ │ ├── oauth-sign@0.8.2
│ │ ├── performance-now@0.2.0
│ │ ├── qs@6.4.0
│ │ ├── safe-buffer@5.1.1
│ │ ├── stringstream@0.0.5
│ │ ├─┬ tough-cookie@2.3.3
│ │ │ └── punycode@1.4.1
│ │ ├── tunnel-agent@0.6.0
│ │ └── uuid@3.1.0
│ ├── semver@5.4.1
│ ├─┬ tar@2.2.1
│ │ ├── block-stream@0.0.9
│ │ ├─┬ fstream@1.0.11
│ │ │ └── graceful-fs@4.1.11
│ │ └── inherits@2.0.3
│ └─┬ tar-pack@3.4.0
│ ├─┬ debug@2.6.9
│ │ └── ms@2.0.0
│ ├── fstream-ignore@1.0.5
│ ├─┬ once@1.4.0
│ │ └── wrappy@1.0.2
│ ├─┬ readable-stream@2.3.3
│ │ ├── core-util-is@1.0.2
│ │ ├── isarray@1.0.0
│ │ ├── process-nextick-args@1.0.7
│ │ ├── string_decoder@1.0.3
│ │ └── util-deprecate@1.0.2
│ └── uid-number@0.0.6
├── reflect-metadata@0.1.10
├─┬ rimraf@2.6.2
│ └─┬ glob@7.1.2
│ ├── fs.realpath@1.0.0
│ ├── inflight@1.0.6
│ ├─┬ minimatch@3.0.4
│ │ └─┬ brace-expansion@1.1.8
│ │ ├── balanced-match@1.0.0
│ │ └── concat-map@0.0.1
│ └── path-is-absolute@1.0.1
├─┬ sqlite3@3.1.13
│ ├── nan@2.7.0
│ └─┬ node-pre-gyp@0.6.38
│ ├─┬ hawk@3.1.3
│ │ ├── boom@2.10.1
│ │ ├── cryptiles@2.0.5
│ │ ├── hoek@2.16.3
│ │ └── sntp@1.0.9
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ ├─┬ nopt@4.0.1
│ │ ├── abbrev@1.1.1
│ │ └─┬ osenv@0.1.4
│ │ ├── os-homedir@1.0.2
│ │ └── os-tmpdir@1.0.2
│ ├─┬ npmlog@4.1.2
│ │ ├─┬ are-we-there-yet@1.1.4
│ │ │ └── delegates@1.0.0
│ │ ├── console-control-strings@1.1.0
│ │ ├─┬ gauge@2.7.4
│ │ │ ├── aproba@1.2.0
│ │ │ ├── has-unicode@2.0.1
│ │ │ ├── object-assign@4.1.1
│ │ │ ├── signal-exit@3.0.2
│ │ │ ├─┬ string-width@1.0.2
│ │ │ │ ├── code-point-at@1.1.0
│ │ │ │ └─┬ is-fullwidth-code-point@1.0.0
│ │ │ │ └── number-is-nan@1.0.1
│ │ │ ├─┬ strip-ansi@3.0.1
│ │ │ │ └── ansi-regex@2.1.1
│ │ │ └── wide-align@1.1.2
│ │ └── set-blocking@2.0.0
│ ├─┬ rc@1.2.1
│ │ ├── deep-extend@0.4.2
│ │ ├── ini@1.3.4
│ │ ├── minimist@1.2.0
│ │ └── strip-json-comments@2.0.1
│ ├─┬ request@2.81.0
│ │ ├── aws-sign2@0.6.0
│ │ ├── aws4@1.6.0
│ │ ├── caseless@0.12.0
│ │ ├─┬ combined-stream@1.0.5
│ │ │ └── delayed-stream@1.0.0
│ │ ├── extend@3.0.1
│ │ ├── forever-agent@0.6.1
│ │ ├─┬ form-data@2.1.4
│ │ │ └── asynckit@0.4.0
│ │ ├─┬ har-validator@4.2.1
│ │ │ ├─┬ ajv@4.11.8
│ │ │ │ ├── co@4.6.0
│ │ │ │ └─┬ json-stable-stringify@1.0.1
│ │ │ │ └── jsonify@0.0.0
│ │ │ └── har-schema@1.0.5
│ │ ├─┬ http-signature@1.1.1
│ │ │ ├── assert-plus@0.2.0
│ │ │ ├─┬ jsprim@1.4.1
│ │ │ │ ├── assert-plus@1.0.0
│ │ │ │ ├── extsprintf@1.3.0
│ │ │ │ ├── json-schema@0.2.3
│ │ │ │ └─┬ verror@1.10.0
│ │ │ │ └── assert-plus@1.0.0
│ │ │ └─┬ sshpk@1.13.1
│ │ │ ├── asn1@0.2.3
│ │ │ ├── assert-plus@1.0.0
│ │ │ ├── bcrypt-pbkdf@1.0.1
│ │ │ ├─┬ dashdash@1.14.1
│ │ │ │ └── assert-plus@1.0.0
│ │ │ ├── ecc-jsbn@0.1.1
│ │ │ ├─┬ getpass@0.1.7
│ │ │ │ └── assert-plus@1.0.0
│ │ │ ├── jsbn@0.1.1
│ │ │ └── tweetnacl@0.14.5
│ │ ├── is-typedarray@1.0.0
│ │ ├── isstream@0.1.2
│ │ ├── json-stringify-safe@5.0.1
│ │ ├─┬ mime-types@2.1.17
│ │ │ └── mime-db@1.30.0
│ │ ├── oauth-sign@0.8.2
│ │ ├── performance-now@0.2.0
│ │ ├── qs@6.4.0
│ │ ├── safe-buffer@5.1.1
│ │ ├── stringstream@0.0.5
│ │ ├─┬ tough-cookie@2.3.3
│ │ │ └── punycode@1.4.1
│ │ ├── tunnel-agent@0.6.0
│ │ └── uuid@3.1.0
│ ├─┬ rimraf@2.6.2
│ │ └─┬ glob@7.1.2
│ │ ├── fs.realpath@1.0.0
│ │ ├── inflight@1.0.6
│ │ ├─┬ minimatch@3.0.4
│ │ │ └─┬ brace-expansion@1.1.8
│ │ │ ├── balanced-match@1.0.0
│ │ │ └── concat-map@0.0.1
│ │ └── path-is-absolute@1.0.1
│ ├── semver@5.4.1
│ ├─┬ tar@2.2.1
│ │ ├── block-stream@0.0.9
│ │ ├─┬ fstream@1.0.11
│ │ │ └── graceful-fs@4.1.11
│ │ └── inherits@2.0.3
│ └─┬ tar-pack@3.4.0
│ ├─┬ debug@2.6.9
│ │ └── ms@2.0.0
│ ├── fstream-ignore@1.0.5
│ ├─┬ once@1.4.0
│ │ └── wrappy@1.0.2
│ ├─┬ readable-stream@2.3.3
│ │ ├── core-util-is@1.0.2
│ │ ├── isarray@1.0.0
│ │ ├── process-nextick-args@1.0.7
│ │ ├── string_decoder@1.0.3
│ │ └── util-deprecate@1.0.2
│ └── uid-number@0.0.6
├─┬ typeorm@0.1.0-alpha.49
│ ├── app-root-path@2.0.1
│ ├─┬ chalk@2.1.0
│ │ ├─┬ ansi-styles@3.2.0
│ │ │ └─┬ color-convert@1.9.0
│ │ │ └── color-name@1.1.3
│ │ ├── escape-string-regexp@1.0.5
│ │ └─┬ supports-color@4.4.0
│ │ └── has-flag@2.0.0
│ ├─┬ cli-highlight@1.1.4
│ │ ├─┬ chalk@1.1.3
│ │ │ ├── ansi-styles@2.2.1
│ │ │ ├── has-ansi@2.0.0
│ │ │ └── supports-color@2.0.0
│ │ ├── he@1.1.1
│ │ ├── highlight.js@9.12.0
│ │ ├─┬ mz@2.7.0
│ │ │ ├── any-promise@1.3.0
│ │ │ └─┬ thenify-all@1.6.0
│ │ │ └── thenify@3.3.0
│ │ └─┬ yargs@4.8.1
│ │ ├── lodash.assign@4.2.0
│ │ ├── os-locale@1.4.0
│ │ ├─┬ read-pkg-up@1.0.1
│ │ │ ├─┬ find-up@1.1.2
│ │ │ │ ├── path-exists@2.1.0
│ │ │ │ └─┬ pinkie-promise@2.0.1
│ │ │ │ └── pinkie@2.0.4
│ │ │ └─┬ read-pkg@1.1.0
│ │ │ ├─┬ load-json-file@1.1.0
│ │ │ │ └─┬ strip-bom@2.0.0
│ │ │ │ └── is-utf8@0.2.1
│ │ │ └── path-type@1.1.0
│ │ ├── which-module@1.0.0
│ │ ├── window-size@0.2.0
│ │ └─┬ yargs-parser@2.4.1
│ │ └── camelcase@3.0.0
│ ├── dotenv@4.0.0
│ ├─┬ js-yaml@3.10.0
│ │ ├─┬ argparse@1.0.9
│ │ │ └── sprintf-js@1.0.3
│ │ └── esprima@4.0.0
│ ├─┬ xml2js@0.4.19
│ │ ├── sax@1.2.4
│ │ └── xmlbuilder@9.0.4
│ ├─┬ yargonaut@1.1.2
│ │ ├─┬ chalk@1.1.3
│ │ │ ├── ansi-styles@2.2.1
│ │ │ └── supports-color@2.0.0
│ │ ├── figlet@1.2.0
│ │ └── parent-require@1.0.0
│ └─┬ yargs@9.0.1
│ ├── camelcase@4.1.0
│ ├─┬ cliui@3.2.0
│ │ └── wrap-ansi@2.1.0
│ ├── decamelize@1.2.0
│ ├── get-caller-file@1.0.2
│ ├─┬ os-locale@2.1.0
│ │ ├─┬ execa@0.7.0
│ │ │ ├─┬ cross-spawn@5.1.0
│ │ │ │ ├─┬ lru-cache@4.1.1
│ │ │ │ │ ├── pseudomap@1.0.2
│ │ │ │ │ └── yallist@2.1.2
│ │ │ │ ├─┬ shebang-command@1.2.0
│ │ │ │ │ └── shebang-regex@1.0.0
│ │ │ │ └─┬ which@1.3.0
│ │ │ │ └── isexe@2.0.0
│ │ │ ├── get-stream@3.0.0
│ │ │ ├── is-stream@1.1.0
│ │ │ ├─┬ npm-run-path@2.0.2
│ │ │ │ └── path-key@2.0.1
│ │ │ ├── p-finally@1.0.0
│ │ │ └── strip-eof@1.0.0
│ │ ├─┬ lcid@1.0.0
│ │ │ └── invert-kv@1.0.0
│ │ └─┬ mem@1.1.0
│ │ └── mimic-fn@1.1.0
│ ├─┬ read-pkg-up@2.0.0
│ │ ├─┬ find-up@2.1.0
│ │ │ └─┬ locate-path@2.0.0
│ │ │ ├─┬ p-locate@2.0.0
│ │ │ │ └── p-limit@1.1.0
│ │ │ └── path-exists@3.0.0
│ │ └─┬ read-pkg@2.0.0
│ │ ├─┬ load-json-file@2.0.0
│ │ │ ├─┬ parse-json@2.2.0
│ │ │ │ └─┬ error-ex@1.3.1
│ │ │ │ └── is-arrayish@0.2.1
│ │ │ ├── pify@2.3.0
│ │ │ └── strip-bom@3.0.0
│ │ ├─┬ normalize-package-data@2.4.0
│ │ │ ├── hosted-git-info@2.5.0
│ │ │ ├─┬ is-builtin-module@1.0.0
│ │ │ │ └── builtin-modules@1.1.1
│ │ │ └─┬ validate-npm-package-license@3.0.1
│ │ │ ├─┬ spdx-correct@1.0.2
│ │ │ │ └── spdx-license-ids@1.2.2
│ │ │ └── spdx-expression-parse@1.0.4
│ │ └── path-type@2.0.0
│ ├── require-directory@2.1.1
│ ├── require-main-filename@1.0.1
│ ├─┬ string-width@2.1.1
│ │ ├── is-fullwidth-code-point@2.0.0
│ │ └─┬ strip-ansi@4.0.0
│ │ └── ansi-regex@3.0.0
│ ├── which-module@2.0.0
│ ├── y18n@3.2.1
│ └── yargs-parser@7.0.0
└── uikit@3.0.0-beta.30
electron-builder 19.36.0
Rebuilding native production dependencies for win32:x64
Packaging app for platform win32 ia32 using electron v1.7.5
Packaging app for platform win32 x64 using electron v1.7.5
Application packaged successfully! [ 'app-builds/angular-electron-starter-win32-ia32',
'app-builds/angular-electron-starter-win32-x64' ]
Process finished with exit code 0
但是当我在Windows上运行.exe时,我收到的错误是我上面提到的sqlite包没有找到。
答案 0 :(得分:0)
SQLite3是一个原生Node.js模块,因此如果不将其重建为目标Electron则不能直接与Electron一起使用.electron-builder将为我们的平台构建原生模块,然后我们可以像往常一样在代码中要求它
以下是您需要执行的步骤。
首先,我们需要在package.json中添加一个后安装步骤:
"scripts": {
"postinstall": "install-app-deps"
...
}
,然后安装必要的依赖项并进行构建:
npm install --save-dev electron-builder
npm install --save sqlite3
npm run postinstall
我在Windows 7(32位)和Windows 10(64位)中使用了相同的过程。我对此没有任何问题。