Electron fails to start when running as root on Linux
See original GitHub issue- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project follows, as appropriate.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Please describe your issue: I’m trying to get electron-forge 6 working in a Docker environment. When I attempt to run the following minimal example, it appears to build correctly but then immediately exits with no error code.
Dockerfile
:
FROM node:8.16.0-stretch
RUN npm install -g npx
WORKDIR /usr/src
RUN npx create-electron-app webpack-demo --template=webpack
WORKDIR /usr/src/webpack-demo
RUN apt-get update
RUN apt-get install libnss3 libgtk-3-0 libxss1 libasound2 -y
ENV DEBUG electron-forge:*
CMD ["npm", "start"]
I see the same behavior if I run npm start
manually within the container after getting into bash (docker run -it webpack-template bash
), and echo $?
returns 0.
Running ls .webpack
in the container shows only the main
directory, where I believe there should also be a renderer
directory:
root@99e500936bf5:/usr/src/webpack-demo# ls .webpack
main
If I do npx create-electron-app webpack-demo --template=webpack
on my Mac, I am able to npm start
successfully and I see a .webpack/renderer
dir. It seems like something is preventing the renderer
build from succeeding in the Docker/Debian environment?
Console output when you run electron-forge
with the environment variable DEBUG=electron-forge:*
. (Instructions on how to do so here). Please include the stack trace if one exists.
Output from running docker build -t webpack-template . && docker run webpack-template
with the above Dockerfile
> webpack-demo@1.0.0 start /usr/src/webpack-demo
> electron-forge start
WARNING: DEBUG environment variable detected. Progress indicators will be sent over electron-forge:lifecycle
2019-07-12T07:16:33.111Z electron-forge:async-ora Process Started: Checking your system
2019-07-12T07:16:33.122Z electron-forge:check-system checking system, create ~/.skip-forge-system-check to stop doing this
2019-07-12T07:16:33.769Z electron-forge:async-ora Process Succeeded: Checking your system -- after 657ms
WARNING: DEBUG environment variable detected. Progress indicators will be sent over electron-forge:lifecycle
2019-07-12T07:16:34.805Z electron-forge:async-ora Process Started: Locating Application
2019-07-12T07:16:34.808Z electron-forge:project-resolver searching for project in: /usr/src/webpack-demo
2019-07-12T07:16:34.813Z electron-forge:project-resolver electron-forge compatible package.json found in /usr/src/webpack-demo/package.json
2019-07-12T07:16:34.815Z electron-forge:async-ora Process Succeeded: Locating Application -- after 9ms
2019-07-12T07:16:34.827Z electron-forge:require-search searching [ '@electron-forge/plugin-webpack',
'/usr/src/webpack-demo/@electron-forge/plugin-webpack',
'/usr/src/webpack-demo/node_modules/@electron-forge/plugin-webpack' ] relative to /usr/src/webpack-demo
2019-07-12T07:16:34.831Z electron-forge:require-search testing @electron-forge/plugin-webpack
2019-07-12T07:16:35.582Z electron-forge:plugin:webpack hooking process events
2019-07-12T07:16:35.629Z electron-forge:async-ora Process Started: Preparing native dependencies
2019-07-12T07:16:36.572Z electron-forge:async-ora Process Succeeded: Preparing native dependencies -- after 943ms
2019-07-12T07:16:36.575Z electron-forge:plugins plugin: "webpack" has taken control of the start command
2019-07-12T07:16:36.589Z electron-forge:async-ora Process Started: Compiling Main Process Code
2019-07-12T07:16:37.519Z electron-forge:async-ora Process Succeeded: Compiling Main Process Code -- after 930ms
2019-07-12T07:16:37.520Z electron-forge:async-ora Process Started: Launch Dev Servers
2019-07-12T07:16:37.574Z electron-forge:async-ora Process Succeeded: Launch Dev Servers -- after 54ms
2019-07-12T07:16:37.574Z electron-forge:async-ora Process Started: Compiling Preload Scripts
2019-07-12T07:16:37.576Z electron-forge:async-ora Process Succeeded: Compiling Preload Scripts -- after 2ms
2019-07-12T07:16:37.581Z electron-forge:async-ora Process Started: Launching Application
2019-07-12T07:16:37.591Z electron-forge:async-ora Process Succeeded: Launching Application -- after 10ms
2019-07-12T07:16:37.594Z electron-forge:plugin:webpack hooking electron process exit
Webpack Output Available: http://localhost:9000
2019-07-12T07:16:37.663Z electron-forge:plugin:webpack handling process exit with: { cleanup: true, exit: true }
2019-07-12T07:16:37.664Z electron-forge:plugin:webpack cleaning webpack watcher
2019-07-12T07:16:37.667Z electron-forge:plugin:webpack cleaning http server
2019-07-12T07:16:37.668Z electron-forge:plugin:webpack stopping logger
2019-07-12T07:16:37.669Z electron-forge:plugin:webpack handling process exit with: { cleanup: true }
Arics-MB-Pro:forge-webpack-bug aric$
What command line arguments are you passing? None
What does your config.forge
data in package.json
look like?
I’m using the webpack template from npx create-electron-app webpack-demo --template=webpack
as is with no modifications.
Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using electron-forge init
is a good starting point, if that is not the
source of your problem.
- Have Docker installed
- Copy minimal
Dockerfile
above to a new dir - In the dir, run
docker build -t webpack-template . && docker run webpack-template
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
See https://www.electronforge.io/cli#start
Alternatively, is it possible to pass the
--no-sandbox
flag to Electron when using forge?