Currently we can publish binaries for Windows and macOS with electron-builder. During development we start our application with electron ./PATH_TO_MAIN.js
and would like to switch to electron-builder start
, since it would consider all the configuration from our electron-builder.json.
Unfortunately we are getting following error with both os (window and macOS)
Error: Cannot find module 'electron-webpack/dev-runner'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at start (/ROOT_PATH/node_modules/electron-builder/out/cli/start.js:10:3)
at _yargs.default.command.command.command.command.command.wrap (/ROOT_PATH/node_modules/electron-builder/out/cli/cli.js:148:239)
at then (/ROOT_PATH/node_modules/electron-builder/out/cli/cli.js:153:97)
From previous event:
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
at Object.args [as handler] (/ROOT_PATH/node_modules/electron-builder/out/cli/cli.js:153:86)
at Object.runCommand (/ROOT_PATH/node_modules/electron-builder/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/ROOT_PATH/node_modules/electron-builder/node_modules/yargs/yargs.js:1014:30)
at Object.get [as argv] (/ROOT_PATH/node_modules/electron-builder/node_modules/yargs/yargs.js:957:21)
at Object.<anonymous> (/ROOT_PATH/node_modules/electron-builder/out/cli/cli.js:148:373)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
We tried it already with different versions of electron-webpack (1.11.0 , 1.13.0 and 2.0.0)
Does anyone else encounter this problem?
I have the same issue but on windows 10. Were you able to fix it?
No, I was not investigating further on this. We still start the application like electron /path/to/main.js
Weird, you would think others would be reporting the same issue. Thanks.
@genepool99 I'm having the same issue on Windows 10 as well. I don't know enough about npm to understand how electron-webpack/dev-runner
is even a valid module. Maybe it's not?
In any case, I suspect the lack of others reporting this issue is more part of the development ethos - you get something working somehow and then just stop worrying about it. I suspect that most people who try to follow the logic at https://www.electron.build/ are actually hitting the same issue.
I'm concerned that I'm using a different version of electron during development and packaging, so I'd like to get this fixed! If someone more knowledgeable about npm can chime in, I'm happy to try to fix it.
electron-builder start
is supposed to be used with electron-webpack. You don't need to use it if you use another framework. Use whatever you want to start app in a dev mode :)
@develar I think you're missing the point. The documentation for electron-builder lists a start
command that doesn't work, even if you are using electron-webpack.
I tracked down the code, and as you can see, it requires electron-webpack/dev-runner
, which isn't a valid path. So, you should at best fix the code so it works, or at the very least remove the start
command and documentation around it.
The correct path is electron-webpack/out/dev/dev-runner
, but as far as I can tell, electron-webpack does not expose a supported public API that you can use to run it outside of the CLI. So if you don't use the CLI, then you risk running into internal changes that break your code.
I agree, why is this closed out? I have both electron-webpack and electron-builder and have to specify the dist as the starting point and build in another step.
The problem still remains in v22.3.2
Most helpful comment
@develar I think you're missing the point. The documentation for electron-builder lists a
start
command that doesn't work, even if you are using electron-webpack.I tracked down the code, and as you can see, it requires
electron-webpack/dev-runner
, which isn't a valid path. So, you should at best fix the code so it works, or at the very least remove thestart
command and documentation around it.The correct path is
electron-webpack/out/dev/dev-runner
, but as far as I can tell, electron-webpack does not expose a supported public API that you can use to run it outside of the CLI. So if you don't use the CLI, then you risk running into internal changes that break your code.