nklayman / vue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron
https://nklayman.github.io/vue-cli-plugin-electron-builder/
MIT License
4.12k stars 280 forks source link

Upgrading electron-builder breaks packaging state #131

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello,

after upgrading to electron-builder 20.33.2 and vue-cli-plugin-electron-builder rc7 the build breaks with the following error:

Error: Application entry file "dist_electron/bundled/background.js" in the "<path>/dist_electron/linux-unpacked/resources/app.asar" does not exist. Seems like a wrong configuration.
    at error (<path>/node_modules/app-builder-lib/out/asar/asarFileChecker.js:44:14)
    at <path>/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:30:4
From previous event:
    at _checkFileInArchive (<path>/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:36:17)
    at checkFileInArchive (<path>/node_modules/app-builder-lib/out/asar/asarFileChecker.js:40:30)
    at <path>/node_modules/app-builder-lib/src/platformPackager.ts:400:13
    at Generator.next (<anonymous>)
From previous event:
    at LinuxPackager.checkFileInPackage (<path>/node_modules/app-builder-lib/src/platformPackager.ts:397:110)
    at <path>/node_modules/app-builder-lib/src/platformPackager.ts:449:16
    at Generator.next (<anonymous>)
    at <path>/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:155:5)
From previous event:
    at LinuxPackager.sanityCheckPackage (<path>/node_modules/app-builder-lib/src/platformPackager.ts:436:70)
    at <path>/node_modules/app-builder-lib/src/platformPackager.ts:240:16
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
    at process.topLevelDomainCallback (domain.js:121:23)
From previous event:
    at LinuxPackager.doPack (<path>/node_modules/app-builder-lib/src/platformPackager.ts:166:165)
    at <path>/node_modules/app-builder-lib/src/platformPackager.ts:112:16
    at Generator.next (<anonymous>)
From previous event:
    at LinuxPackager.pack (<path>/node_modules/app-builder-lib/src/platformPackager.ts:110:95)
    at <path>/node_modules/app-builder-lib/src/packager.ts:375:24
    at Generator.next (<anonymous>)
    at xfs.stat (<path>/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at <path>/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:155:5)
From previous event:
    at Packager.doBuild (<path>/node_modules/app-builder-lib/src/packager.ts:343:39)
    at <path>/node_modules/app-builder-lib/src/packager.ts:313:57
    at Generator.next (<anonymous>)
    at <path>/node_modules/graceful-fs/graceful-fs.js:111:16
    at <path>/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:141:20)
From previous event:
    at Packager._build (<path>/node_modules/app-builder-lib/src/packager.ts:284:133)
    at <path>/node_modules/app-builder-lib/src/packager.ts:280:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
    at process.topLevelDomainCallback (domain.js:121:23)
From previous event:
    at Packager.build (<path>/node_modules/app-builder-lib/src/packager.ts:237:14)
    at build (<path>/node_modules/app-builder-lib/src/index.ts:59:28)
    at Object.build (<path>/node_modules/electron-builder/src/builder.ts:227:10)
    at buildApp (<path>/node_modules/vue-cli-plugin-electron-builder/index.js:172:14)
    at bundle.run (<path>/node_modules/vue-cli-plugin-electron-builder/index.js:154:15)
    at finalCallback (<path>/node_modules/webpack/lib/Compiler.js:210:39)
    at hooks.done.callAsync.err (<path>/node_modules/webpack/lib/Compiler.js:259:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (<path>/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (<path>/node_modules/tapable/lib/Hook.js:154:20)
    at emitRecords.err (<path>/node_modules/webpack/lib/Compiler.js:257:22)
    at Compiler.emitRecords (<path>/node_modules/webpack/lib/Compiler.js:372:39)
    at emitAssets.err (<path>/node_modules/webpack/lib/Compiler.js:251:10)
    at hooks.afterEmit.callAsync.err (<path>/node_modules/webpack/lib/Compiler.js:358:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (<path>/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (<path>/node_modules/tapable/lib/Hook.js:154:20)
    at asyncLib.forEach.err (<path>/node_modules/webpack/lib/Compiler.js:355:27)
    at <path>/node_modules/neo-async/async.js:2825:7
    at done (<path>/node_modules/neo-async/async.js:2861:11)
    at <path>/node_modules/neo-async/async.js:2813:7
    at <path>/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:141:20)
error Command failed with exit code 1.

package.json deps:

"dependencies": {
    "async": "^2.6.1",
    "aws-sdk": "^2.298.0",
    "debounce": "1.2.0",
    "electron-localshortcut": "^3.1.0",
    "electron-store": "^2.0.0",
    "electron-unhandled": "^1.1.0",
    "electron-updater": "^3.2.0",
    "lodash": "^4.17.11",
    "mkdirp": "^0.5.1",
    "mousetrap": "^1.6.2",
    "mousetrap-pause": "^1.0.0",
    "mousetrap-record": "^1.0.1",
    "pouchdb-browser": "^7.0.0",
    "properties-reader": "^0.0.16",
    "svg.js": "^2.6.5",
    "vue": "^2.5.17",
    "vuetify": "^1.0.19",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@babel/polyfill": "^7.0.0",
    "@vue/cli-plugin-babel": "^3.0.1",
    "@vue/cli-plugin-eslint": "^3.0.5",
    "@vue/cli-plugin-unit-jest": "^3.0.3",
    "@vue/cli-service": "^3.0.1",
    "@vue/eslint-config-prettier": "^3.0.5",
    "@vue/test-utils": "^1.0.0-beta.25",
    "babel-core": "^7.0.0-bridge",
    "babel-jest": "^23.6.0",
    "electron": "^2.0.2",
    "electron-builder": "^20.33.2",
    "eslint-plugin-jest": "^21.24.1",
    "lint-staged": "^8.0.4",
    "material-design-icons-iconfont": "^3.0.3",
    "mock-fs": "^4.7.0",
    "mock-spawn": "^0.2.6",
    "vue-cli-plugin-electron-builder": "^1.0.0-rc.7",
    "vue-cli-plugin-vuetify": "^0.1.6",
    "vue-template-compiler": "^2.5.17",
    "yorkie": "^2.0.0"
  },

Pinning versions as the following works as expected:

"dependencies": {
    ...
    "electron-updater": "3.1.2",
    ...
},
"devDependencies": {
    ...
    "vue-cli-plugin-electron-builder": "1.0.0-rc.3",
    ...
},
"resolutions": {
    "webpack": "4.19.0",
    "electron-builder": "20.28.1"
  }

I noticed you closed #130 but apparently there is something breaking still.

Thank you for your effort and any feedback you'll be able to provide!

nklayman commented 5 years ago

130 was closed because failing test results were caused by my code (it was failing everywhere), not electron-builder. I will look into this more later.

nklayman commented 5 years ago

It works fine for me, try re-invoking the generator with vue invoke electron-builder. Also try deleting node_modules and re-installing.

 INFO  Building app with electron-builder:
  • electron-builder version=20.33.2
  • description is missed in the package.json appPackageFile=/home/noah/Documents/HTML/electron-test/dist_electron/bundled/package.json
  • author is missed in the package.json appPackageFile=/home/noah/Documents/HTML/electron-test/dist_electron/bundled/package.json
  • writing effective config file=dist_electron/builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=linux arch=x64 electron=3.0.8 appOutDir=dist_electron/linux-unpacked
 DONE  Build complete!
itsnwa commented 5 years ago

@nklayman I get this error message with all dependencies up-to-date. I also tried vue invoke electron-builder

Error: Application entry file "background.js" in the "/Users/nichlas/code/[app name]/build/mac/[app name].app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration.

My vue.config.js file looks like this:

module.exports = {
  runtimeCompiler: true,
  pluginOptions: {
    electronBuilder: {
      builderOptions: {
        productName: 'App name',
        appId: 'io.appname.app',
        copyright: 'Copyright © 2019 App name',
        publish: {
          provider: 'github'
        },
        directories: {
          output: 'build'
        },
        files: ['dist_electron/**/*'],
        dmg: {
          title: 'App name',
          contents: [
            {
              x: 410,
              y: 190,
              type: 'link',
              path: '/Applications'
            },
            {
              x: 130,
              y: 190,
              type: 'file'
            }
          ]
        },
        mac: {
          icon: 'public/icons/icon.icns'
        },
        win: {
          icon: 'public/icons/icon.ico'
        }
      }
    }
  }
}

package.json:

{
  "name": "app name",
  "version": "0.4.4",
  "private": true,
  "description": "description",
  "author": "Nichlas <my@email.com>",
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "electron:build": "vue-cli-service electron:build",
    "electron:serve": "vue-cli-service electron:serve",
    "postinstall": "electron-builder install-app-deps",
    "ship:major": "npm version major && vue-cli-service electron:build && electron-builder -mw -p always",
    "ship:minor": "npm version minor && vue-cli-service electron:build && electron-builder -mw -p always",
    "ship:patch": "npm version patch && vue-cli-service electron:build && electron-builder -mw -p always"
  },
  "dependencies": {
    "electron-debug": "^2.0.0",
    "electron-settings": "^3.2.0",
    "vue": "^2.5.22",
    "vue-router": "^3.0.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.3.0",
    "@vue/cli-plugin-eslint": "^3.3.0",
    "@vue/cli-service": "^3.3.0",
    "@vue/eslint-config-prettier": "^4.0.0",
    "babel-eslint": "^10.0.1",
    "electron": "^4.0.1",
    "eslint": "^5.12.1",
    "eslint-plugin-vue": "^5.1.0",
    "node-sass": "^4.9.0",
    "sass-loader": "^7.0.1",
    "vue-cli-plugin-electron-builder": "^1.0.0-rc.10",
    "vue-template-compiler": "^2.5.22"
  },
  "main": "background.js"
}