-
Notifications
You must be signed in to change notification settings - Fork 78
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
wait-on perpetually returns ECONNREFUSED when using localhost, but works fine using 127.0.0.1 #109
Comments
+1 on this, I'm using vite's "preview" functionality to run my app. It works if I use |
We faced the error in https://github.com/opossum-tool/OpossumUI when upgrading to node 17. Replacing |
Most likely cause is nodejs/node#39987 (see also nodejs/node#40537). |
See this issue here: jeffbski/wait-on#109
+1 still a thing in node 18 |
- Using concurrently to launch electron once react is running - "start-react" script launches react with BROWSER=none to prevent default opening of a browser tab at launch - "start-electron" script launches electron once wait-on received http 200 status code from http://127.0.0.1:3000 - Had to use 127.0.0.1 instead of "localhost" in the wait-on url, as wait-on can hang trying to resolve localhost. see wait-on github issues for further details (jeffbski/wait-on#109) - Updated start script in package.json - running npm start now launches react with BROWSER=none using cross-env, then launches electron-start to launch electron after the wait-on is successful
"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
Experienced the same thing. It took me a few hours to track this down. I think it would be useful, if not important, for the project to handle this in some fashion since LTS is 18.12.0 and current Node version is 19.0.0. Two solutions for me were to:
|
Hey! This is not an issue from the library itself, but from this change previously mentioned: node#39987. As some times and depending on the OS is possible that it will return an The recommendation is to be careful and try to listen to verify if the tool/service listens to both IP versions, and if note, point directly to the one that is resolved first on your |
|
Hi guys! It seems that sadly the project hasn't been active lately, and issues are just pilling up 🙁 The effort is not to replace this great project but try to continue adding support to it in parallel. Hopefully, you'll find it helpful 🙂 It is important to notice that I made some refactors and improvements, for instance, the current version is Hope you found it useful and am happy to help you through the issues section of the project. Looking forward to your feedback! |
Hello folks! It seems that in v18.12.1 the same is happening. |
It happens because the happy eyeballs option is not enabled by default 🙁 |
"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
For anyone affected by this, according to #137 (comment) the defaults changed in Node 20 and this should work again out-of-the-box. So for anyone running into this with Node 17, 18 or 19 — try upgrading to Node 20 to see if that makes any difference for your case. |
I tried this today with Node 20.10.0 and Vite 4.3.9, the only way I found to avoid
Edit: Actually, when I use |
I had been using the start-server-and-test module for kicking off my server, and then starting my tests, however I couldn't get it to work using http. I ended up creating a minimal repro here (note the wait-on-defect branch).
I realized that it does however, work fine if I switch my
localhost
to127.0.0.1
. I can curl the localhost fine in a terminal window and it returns the html string. I'm using next js as my server, which does run via webpack, so using http-get, but to no avail.repro steps:
wait-on-defect
branchyarn install
yarn test:integration
The text was updated successfully, but these errors were encountered: