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
ECONNREFUSED on NodeJS 18 #1624
Comments
|
Calling the server using curl http://localhost:3344 -v
* Trying 127.0.0.1:3344...
* Connected to localhost (127.0.0.1) port 3344 (#0)
> GET / HTTP/1.1
> Host: localhost:3344
> User-Agent: curl/7.83.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-type: text/html; charset=utf-8
< cache-control: no-cache
< content-length: 17
< accept-ranges: bytes
< Date: Fri, 12 Aug 2022 07:14:03 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
{"value":"hello"}* Connection #0 to host localhost left intactAlso, running the server in NodeJS 16.16.0, the |
|
I started seeing this and the only solution I found was to use the IP |
This would be since I believe that this error exists when using the builtin If you want to move forward with this I would suggest first seeing if you can reproduce the same issue using the builtin |
|
Can confirm this issue on Node version v18.8.0. I am getting the very same error on different port 8080. Calling with curl works, calling from node results in I can also confirm that the very same code works on node v16.17.0. I can also confirm that changing OS: NixOS, Linux. |
|
Indeed it is issue with nodejs. nodejs/node#40702 |
|
One thing to check for people seeing this on Macs, specifically with port 5000, is Airplay Receiver. I learned that it actually uses localhost:5000 and it was the reason, at least in my case, that the IP worked, but localhost didn't. I think an update from our IT must've enabled it without me realizing it |
|
I experience the same issue, |
That worked for me! |
works on node 16 but above solution doesn't work even if the IP were changed to localhost |
|
there was a breaking change in node v17 that changed the default IP resolving. ip6 is preferred by default. You can add |
This fixed the issue, didn't realize the cause was from Node and going by the error message I got, thought it was something else. Thanks anyway. |
|
At this point it seems like the underlying problem is identified, and that there is nothing that should be changed in |
Changing 'localhost' to '127.0.0.1' has fixed the problem for me. |
|
why was this closed? we are still having this issue when using 'localhost' |
|
Is there anyone having this issue in Ubuntu 20.04.6 with node version 18.19.0? |
…lity with node 18. See node-fetch/node-fetch#1624.
…lity with node 18. See node-fetch/node-fetch#1624.
…lity with node 18. See node-fetch/node-fetch#1624.
…lity with node 18. See node-fetch/node-fetch#1624.
When using
node-fetchon NodeJS 18, got ECONNREFUSEDSteps to reproduce the behavior:
FetchError: request to http://localhost:3344/ failed, reason: connect ECONNREFUSED ::1:3344 at ClientRequest.<anonymous> (file:///D:/code/mocktomata/node_modules/node-fetch/src/index.js:108:11) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:481:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { type: 'system', errno: 'ECONNREFUSED', code: 'ECONNREFUSED', erroredSysCall: 'connect' }Expected behavior
The same script will work in NodeJS 16.
Video repro: https://youtu.be/PgyYPw4RCoI
Your Environment
The text was updated successfully, but these errors were encountered: