'EACCES: permission denied 0.0.0.0:3000 in Windows Next js

When I try to start the next js server with yarn dev it will throw me up with this error. I need to restart the entire system in order for it to work. And I'm running it on windows. It takes forever.

Error: listen EACCES: permission denied 0.0.0.0:3000
    at Server.setupListenHandle [as _listen2] (net.js:1301:21)
    at listenInCluster (net.js:1366:12)
    at doListen (net.js:1503:7)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  code: 'EACCES',
  errno: -4092,
  syscall: 'listen',
  address: '0.0.0.0',
  port: 3000
}


Solution 1:[1]

The "solution" on windows for many people seems to disable virtual ethernet adapters (especially when you use docker). It could also be that another program is using the same port, which you can find out by using netstat -a.

I disable all vEthernet adapters that were not in use and restarted. At some point it magically worked again. The setting can be found here: Control Panel > Network and Internet > Network Connections

source: https://github.com/BrowserSync/browser-sync/issues/1705#issuecomment-508846475

(Honestly the most annoying bug I had in a long time and a reason to switch to linux)

Solution 2:[2]

run this .bat file

%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
net stop winnat
net start winnat
exit

Solution 3:[3]

For me, it was Grafana running on that port. Just open http://localhost:3000 and maybe you find out what's running there and stop it at Services (Windows).

Solution 4:[4]

Not sure if this is the same issue but my error was:

Error: listen EACCES: permission denied 0.0.0.0:3000
... Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1357:8)
    at processTicksAnd

And this fixed it: Restarting the service "Host Network Service"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matthias Pitscher
Solution 2 Huaiyu Huang
Solution 3 Edylson Frederico
Solution 4 Christopher