电子生成器无法为我的React Web App构建窗口可执行文件

时间:2019-04-13 11:01:42

标签: reactjs electron-builder

在电子的构建过程中失败了。 electronic-builder -w,我试图调整电子启动器的位置,但徒劳无功。 我碰巧使用已经弹出的create-react-app可能会有所帮助,并且一直在遵循本教程。 From React to an Electron app ready for production 这是我在构建窗口可执行文件时遇到的错误

 Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
  • electron-builder version=20.39.0
  • loaded configuration file=package.json ("build" field)
  • rebuilding native production dependencies platform=win32 arch=x64
  • packaging       platform=win32 arch=x64 electron=4.0.1 appOutDir=dist\win-unpacked
Error: Application entry file "public\electron-starter.js" in the "D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\dist\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.
    at error (D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\out\asar\asarFileChecker.js:44:14)
    at D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\asar\asarFileChecker.ts:30:4
    at Generator.next (<anonymous>)
    at D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\graceful-fs\polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:155:5)
From previous event:
    at _checkFileInArchive (D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\asar\asarFileChecker.ts:36:17)
    at checkFileInArchive (D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\out\asar\asarFileChecker.js:40:30)
    at D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\platformPackager.ts:409:13
    at Generator.next (<anonymous>)
From previous event:
    at WinPackager.checkFileInPackage (D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\platformPackager.ts:406:110)
    at D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\platformPackager.ts:460:16
    at Generator.next (<anonymous>)
    at D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\graceful-fs\polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:155:5)
From previous event:
    at WinPackager.sanityCheckPackage (D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\platformPackager.ts:446:92)
    at D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\platformPackager.ts:249:16
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
From previous event:
    at WinPackager.doPack (D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\platformPackager.ts:167:165)
    at D:\node4\projectz\react_stuff\react_lessons\mobx\bizwatch\node_modules\app-builder-lib\src\platformPackager.ts:113:16
    at Generator.next (<anonymous>)

也许我的package.json文件将有助于了解情况

"main": "public/electron-starter.js",
  "scripts": {
    "build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
    "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
    "start-js": "node scripts/start.js",
    "start": "npm-run-all -p watch-css start-js",
    "build": "npm run build-css && node scripts/build.js",
    "test": "node scripts/test.js --env=jsdom",
    "electron-dev": "concurrently \"BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\"",
    "preelectron-pack": "yarn build",
    "electron-pack": "build --w"
  },
  "build": {
  "appId": "com.example.bizwatch",
  "files": [
    "build/**/*",
    "node_modules/**/*"
  ],
  "directories":{
    "buildResources": "assets"
  }
 },

0 个答案:

没有答案