Linux – How to fix `listen EACCES: permission denied` on any port

node.jsnpmwindows-subsystem-for-linux

Has anyone experienced something liked this with node:

I was running Angular, my Windows crashed and restarted and now when I try ng serve I'm getting:

Error: listen EACCES: permission denied 127.0.0.1:4200
    at Server.setupListenHandle [as _listen2] (net.js:1253:19)
    at listenInCluster (net.js:1318:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1451:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)

I also tried ng serve --port 4201

Same result.

NOTE: Before Windows restarted I was running the app in WSL. After, I tried WSL and Powershell.

Update: It is even happening with a new project.

Best Answer

One Windows restart isn't enough, I restarted twice and the problem is gone.

Sorry, I don't have anything more technical.

Except: 1: Try not to develop on WSL from a Windows folder.

Related Question