I was trying to run a front end project locally after pulling it down from git. After which I got the following error:
vents.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 127.0.0.1:8081
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1501:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `webpack-dev-server --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I was like, "Hold up, i'm not running anything!!". or was I? After running
sudo lsof -i :8081
I saw:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
cma 265 root 16u IPv6 0x2756c3c2bce3e369 0t0 TCP *:sunproxyadmin (LISTEN)
I saw that webpack-dev-server was trying to start on the same port as sunproxyadmin
...
devServer: {
port: 8081,
hot: true,
},
...
Ok, so what is sunproxyadmin
and who is cma
(get off my lawn!!!)
(btw I know how to kill it)
PS: Some one with more stack overflow points who agrees please create tags for sunproxyadmin, EADDRINUSE and cma
After digging around I see that cma is an agent of Mcaffe which is using sunproxyadmin.
I figured I could just find out how to change the port it uses but then I don't have access to change the port that it uses on my machine because it is set by our IT department and the process itself is started by the root user:
The wakeup port is a global setting, so you can't just change it on certain agents: it has to be all of them...
To change the port, simply change it in the Configuration / Server Settings page, and the agents will pick up the new port the next time they contact the server.
https://community.mcafee.com/t5/ePolicy-Orchestrator/Linux-CMA-Agent-port-chnage/td-p/314596
Most searches on this topic lead to issues with react for some reason which is probably why I found the solution for killing it here:
sudo lsof -n -i4TCP:8081 # get the process' PID
sudo launchctl list | grep 5693 # find the launchd endpoint
sudo launchctl remove com.mcafee.agent.macmn
So in the end killing it was my only recourse other than changing the port webpack dev server starts up with.