Closed KrisCarr closed 8 months ago
Seems like a problem with Node 18, as I cannot reproduce it on Node 14 or 16 That said, half the packages around won't support Node 18 yet, so we don't see this a priority for now Please use Node 14 or 16 for now
Thanks for reporting anyway, we'll work on this later on
Having the same issue here and can confirm that switching back to Node 16 helped.
However I decided to follow the workaround proposed by @KrisCarr and used http-get://127.0.0.1:9000
with Node 18 and it worked.
Thanks @KrisCarr !
I'm pretty sure there was a reason why I didn't go with 127.0.0.1
in the first place, but I'm not sure which was it
I think browsers or os have some special handling for localhost
keyword which bypass some security checks
I'll explore that option again in the future
@KrisCarr, @IlCallo, @mv-go, I have faced the same issue in my project/setup, but I've also found a different workaround: put the http://
before the localhost
. To be more clear: replace http-get://localhost:9000
with http-get://http://localhost:9000
. In my case it solves the problem, and I'd be more than happy to hear from you! 🙂
I just tried it out again today and could not reproduce with this setup
Ubuntu: 22.04 Node: 18.14.1 NPM: 9.3.1 Cypress: 12.7.0
Is this an issue only on Windows/Mac?
Is this an issue only on Windows/Mac?
@IlCallo, it might be, but it should probably be confirmed by somebody else (more testers needed).
@IlCallo I have re-tested and can confirm it is still an issue at least on macOS with M1 chip (don't have access to another machine at the moment to test others).
I first tried with Node 18.12.0 that was currently installed then updated to 18.14.2
Updated reproduction commands:
yarn create quasar
choosing options: Vite, Typescript
yarn quasar ext add @quasar/testing-e2e-cypress
choosing options: Scripts & Typescript (didn't bother ticking coverage)
This then hangs silently in a retry loop failing to connect to ::1, it does eventually give up after quite a while:
yarn test:e2e:ci
Running this shows the verbose output showing the underlying attempts:
DEBUG=start-server-and-test yarn test:e2e:ci
Output:
making HTTP(S) get request to url:http://localhost:9000 ...
HTTP(S) error for http://localhost:9000 Error: connect ECONNREFUSED ::1:9000
making HTTP(S) get request to url:http://localhost:9000 ...
HTTP(S) error for http://localhost:9000 Error: connect ECONNREFUSED ::1:9000
making HTTP(S) get request to url:http://localhost:9000 ...
HTTP(S) error for http://localhost:9000 Error: connect ECONNREFUSED ::1:9000
Full output from command execution to the above (attached to save space):
I have the exact same problem with:
In my case the error reported is:
Error: Timed out waiting for: http-get://localhost:4444
Reverting to Node.js 16 solves this.
Hey there, did anyone test this on latest versions of Node 18 or even Node 20? I still don't own a Mac, and don't plan to buy one soon, but since the problem is obviously related to Node 18 I guess the best course of action would be to search for similar issues into Node repo
A guy on Discord tested with Node 20 on Windows and apparently it works on that version I still have no idea why only Node 18 is failing and why only on Windows or Mac, but since Node 20 is already out since some time, skipping Node 18 altogether could be a workaround to the problem without being stuck on Node 16 which is close to EOL
I'm on a Mac (13.5.2) using Node 20 and Cypress 13, the fix for me was replacing localhost
with 127.0.0.1
in both cypress.config.ts
and package.json
scripts, after doing this everything is working fine for me.
This seems to be the culprit: https://github.com/nodejs/node/issues/47785
Node <18 resolved localhost to 127.0.0.1, while Node >= 18 (on Mac for sure, and on Windows for Node 18 for sure) resolve to its IPv6 counterpart ::1
As expected, took me quite a while to properly understand issue root and test the fix I just tagged Cypress AE v5.2 with the fix, which will of course only apply to newly generated projects
If you're curious about the backstory, check these links out: https://github.com/quasarframework/quasar-testing/commit/8552ba37abf309d8e230eb150b596ae5b2d28cbb#diff-0df604707cf8f7ef7a25247848b4f8ef0383458d0138fb6e50af9f8d17554079R84-R95
TL;DR: Node 18 did a mess with localhost
resolution mechanism, thus the need to use 127.0.0.1
, Node 20 implemented "Happy Eyeballs" protocol which should make everything work as it was before
We'll revert to using localhost
when Node 18 won't be maintained anymore
Well done, @IlCallo! Thank you! ❤️
Thank you for your patience 😁
Software version
OS: Macos / Windows 10 Node: 18.2.0 NPM: 8.10.0 Any other software related to your bug:
What did you get as the error?
running the generated script
test:e2e
ortest:e2e:ci
causes a hang. Upon adding the debug environment variable forstart-test
it is getting a connection refused on ::1What were you expecting?
Cypress to start
What steps did you take, to get the error?
yarn create quasar
choosingvite
.yarn test:e2e
oryarn test:e2e:ci
Current fix / workaround
It appears the generated scripts in
package.json
tellstart-test
to listen forhttp-get://localhost:9000
which is resolving to::1
at runtime. This is not listened on byquasar dev
out-the-box.The current fix is to change the script to listen for
http-get://127.0.0.1:9000
to force ipv4 or to change the listen address for the dev server.