EACCES: permission denied 0.0.0.0:3000 in Windows Next js

Viewed 3390

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
}
4 Answers

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

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)

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"

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).

Related