Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where electron doesn't open with electron:dev task #48

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

Macil
Copy link
Contributor

@Macil Macil commented Oct 13, 2022

On Windows (probably other systems too) with Node 17+, running yarn electron:dev fails to open electron. This happens because the "wait-on http://localhost:3000" step of the script never succeeds.

react-scripts start launches a dev server on IPv4 (because https://github.com/facebook/create-react-app/blob/d960b9e38c062584ff6cfb1a70e1512509a966e7/packages/react-scripts/scripts/start.js#L56 specifies that it listens on "0.0.0.0", an IPv4 address). wait-on http://localhost:3000 tries to connect over IPv6 and fails. By changing the command to wait-on http://127.0.0.1:3000, wait-on will make an IPv4 request and succeed, allowing electron to open.

Here's a related thread about other people running into this issue with wait-on and working around it similarly: jeffbski/wait-on#109

"react-scripts start" launches a dev server on IPv4.
With Node 17+ on Windows, "wait-on http://localhost:3000" tries to connect over IPv6 and fails.
By changing the command to "wait-on http://127.0.0.1:3000", wait-on will make an IPv4 request and succeed, allowing electron to open.

Here's a related thread about other people running into this issue: jeffbski/wait-on#109
@yhirose yhirose merged commit 457e557 into yhirose:master Oct 13, 2022
@yhirose
Copy link
Owner

yhirose commented Oct 13, 2022

Thanks a lot!

@davidruizdiaz
Copy link

The solution worked on node v18. Thank you very much for the help!

@Macil Macil deleted the wait-on-fix branch February 3, 2023 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants