electron-releases icon indicating copy to clipboard operation
electron-releases copied to clipboard

Error to launch with vue-cli-plugin-electron-builder

Open landscht opened this issue 3 years ago • 4 comments

Hi, I have a vue project and have installed electron via the vue add electron-builder command. I end up with electron: 18.0.0 without widevine. I need widevine to launch the spotify sdk player. I try to put github:castlabs/electron-releases#v18.0.0+wvcus in electron: in my package.json, I do npm install, npm run electron:serve, and I get this error message:

 Starting development server...
[10%] building (0/0 modules)
/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/vue-cli-plugin-electron-builder/node_modules/semver/classes/semver.js:38
      throw new TypeError(`Invalid Version: ${version}`)
            ^

TypeError: Invalid Version: github:castlabs/electron-releases#v18.0.0+wvcus
    at new SemVer (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/vue-cli-plugin-electron-builder/node_modules/semver/classes/semver.js:38:13)
    at compare (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/vue-cli-plugin-electron-builder/node_modules/semver/functions/compare.js:3:3)
    at Object.gte (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/vue-cli-plugin-electron-builder/node_modules/semver/functions/gte.js:2:30)
    at chainWebpack (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/vue-cli-plugin-electron-builder/lib/webpackConfig.js:9:30)
    at /Users/tonylandschoot/Documents/work/perso/playfy/node_modules/vue-cli-plugin-electron-builder/index.js:55:5
    at /Users/tonylandschoot/Documents/work/perso/playfy/node_modules/@vue/cli-service/lib/Service.js:268:40
    at Array.forEach (<anonymous>)
    at Service.resolveChainableWebpackConfig (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/@vue/cli-service/lib/Service.js:268:26)
    at Service.resolveWebpackConfig (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/@vue/cli-service/lib/Service.js:272:48)
    at PluginAPI.resolveWebpackConfig (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/@vue/cli-service/lib/PluginAPI.js:132:25)
    at serve (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/@vue/cli-service/lib/commands/serve.js:75:31)
    at Service.run (/Users/tonylandschoot/Documents/work/perso/playfy/node_modules/@vue/cli-service/lib/Service.js:262:12)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /Users/tonylandschoot/Documents/work/perso/playfy/node_modules/vue-cli-plugin-electron-builder/index.js:299:22
➜  playfy git:(master) ✗ node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 59333.
    at /Users/tonylandschoot/Documents/work/perso/playfy/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:47:47
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: undefined,
  signal: undefined
}
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 59334.
    at /Users/tonylandschoot/Documents/work/perso/playfy/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:47:47
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: undefined,
  signal: undefined
}

if you need more details do not hesitate

landscht avatar Apr 07 '22 23:04 landscht

I have exactly zero experience with Vue, but this is clearly a limitation of vue-cli-plugin-electron-builder as it does not seem to be able to handle direct GitHub links as the version in package.json.

If you set up the Vue based Electron project manually instead I think you would have a better chance to get it to work, I seem to remember someone doing just that in the past. Unfortunately it is a bit out of my purview, but perhaps someone else around here can help.

khwaaj avatar Apr 08 '22 00:04 khwaaj

Version 2.0.0 of vue-cli-plugin-electron-builder has this issue. It's fixed in version v3.0.0-alpha.0 of the plugin.

It doesn't look like the plugin is very actively maintained. You can make your own very of the plugin and just update line 9 in the lib/webpackConfig.js from:

  const realDirname = semver.gte(
    ((devDependencies || {}).electron || '12.0.0').replace(/^\^/, ''),
    '12.0.0'
  )
    ? '__dirname.replace(/electron\\.asar(\\\\|\\/)renderer/, "app.asar")'
    : 'require("electron").remote.app.getAppPath()'

To what is shown in v3 aplha:

const realDirname = '__dirname.replace(/electron\\.asar(\\\\|\\/)renderer/, "app.asar")'

silverark avatar Nov 17 '22 17:11 silverark

Hi @landscht , have you got solution for this. I have the same problem, try fix 2 days but it still not work. Thank you.

vanminhquangtri avatar Jun 29 '23 00:06 vanminhquangtri

https://github.com/Alex313031/quark-player here's a working app

MulverineX avatar Jul 10 '23 07:07 MulverineX