Karma + Node.js 17: can't connect to karma server. There is no server listening on port 9876
See original GitHub issueWhen running under Node 17, running karma reports:
can't connect to karma server. There is no server listening on port 9876
Switching back to Node 16 seems to “fix” the issue.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Karma + Node.js 17: can't connect to karma server. There is ...
Karma + Node.js 17: can't connect to karma server. There is no server listening on port 9876. Relates to 1. Relates to 1...
Read more >How to fix "There is no server listening on port 9876" error ...
Now simply launch karma by using the start command with the config file as an input karma start path/to/tests/karma.conf.js.
Read more >How to fix “There is no server listening on port 9876” error ...
I am running the following: PS D:\app> karma run. It shows the error: [2013-11-29 17:39:54.297] [DEBUG] config - Loading config D:\app\karma.conf.js There ......
Read more >How to fix "There is no server listening on port ... - Blogarama
It shows the error: [2013-11-29 17:39:54.297] [DEBUG] config - Loading config D:\app\karma.conf.js There is no server listening on port 9876.
Read more >Angular-Karma-Test-Explorer/Bugs - Gitter
[3:00:17 PM] INFO: Listening to AngularReporter events on port 9879 ... not finding the tests, must be an issue with the karma.conf.js but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/nodejs/node/issues/40702 seems to be the culprit. Node 17 changed the DNS resolution, so now it resolves
localhost
according to the OS settings instead of IPv4 first. The Karma server only listens on IPv4 address (0.0.0.0
) by default, but the requests are sent tolocalhost
andlocalhost
is resolved into IPv6 address (::
) in Node 17+. So the run request is unable to reach the Karma server.I’ll think what’s the best way to make it work out of the box. In the meantime you can address the issue by setting
listenAddress
to::
either in config or usingLISTEN_ADDR
environment variable.Hey @devoto13 Thanks for looking into this.
Indeed, I just realised that the root cause of the issue is that I use VPN (NordVPN to be specific). Without it, the server starts just fine, so I guess VPN is messing with my network configuration.
Anyway, I’ve changed karma
net-utils.js
code locally to omithost
- and it works both with VPN and without it. For now I can uselistenAddress: 'localhost'
as a workaround.