If I run a server with the port 80, and I try to use xmlHTTPrequest i get this error: Error: listen EADDRINUSE
Why is it problem for nodejs, if I want t
While killing the NODE_PORT, it might kill your chrome process or anything that is listening to the same port, and that's annoying.
This shell script may be helpful - in my case the port is 1337 but you can change it anytime
# LOGIC
CHROME_PIDS=`pidof chrome`
PORT_PIDS=`lsof -t -i tcp:1337`
for pid in $PORT_PIDS
do
if [[ ${CHROME_PIDS} != *$pid* ]];then
# NOT FOUND IN CHROME PIDS
echo "Killing $pid..."
ps -p "$pid"
kill -kill "$pid"
fi
done
sails lift
# OR 'node app' OR whatever that starts your node
exit