I think I found a solution. This discussion comment on next.js on github has a similar setup like me - behind a 5G router instead of wired connection to ISP.
Adding the option --network-family-autoselection-attempt-timeout=500
and setting it on NODE_OPTIONS
environment variable has solved issue for me as well. As said in the github comment the default --network-family-autoselection-attempt-timeout
is 250ms, increasing this seems to be the solution.
export NODE_OPTIONS="--network-family-autoselection-attempt-timeout=500"
The issue is probably related to TypeError: fetch failed - on Node v20.11.1 and v21.7.1, but works on v18.19.1 -
PS: Baffling thing is Debian 12+NAT on VirtualBox also started working!