You can simplify this process by using concurrently and wait-on command line tools.
Here are the start scripts I use
“react-start”: “$(npm bin)/react-scripts start”,
“electron-start”: “ELECTRON_DEV=1 $(npm bin)/electron .”,
“start”: “$(npm bin)/concurrently ‘npm react-start’ ‘$(npm bin)/wait-on http://localhost:3000/ && npm electron-start’”,
In other words, it runs concurrently react-scripts start
and electron .
but by adding wait-on http://localhost:3000/
we make sure that the webpack server is running before starting electron.
By doing so you can remove the electron-wait-react script (replaced by wait-on) and the procfile / foreman (replaced by concurrently).