Recently when I was preparing the Angularjs node.js demo, I encountered this error in my mac development, as follows:
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: connect ECONNREFUSED
at errnoException (net.js:770:11)
at Object.afterConnect [as oncomplete] (net.js:761:19)
Finally found the solution on stackoverflow. This is mainly because the node.js server process was still running and not shut down last time, so we need to kill this process. The operation on mac is:
ps aux | grep node
twer 7668 4.3 1.0 42060 10708 pts/1 Sl 20:36 0:00 node server
twer 7749 0.0 0.0 4384 832 pts/8 S 20:37 0:00 grep --color=auto node
You can see from the output that process PID7668 is in use, so we must kill this die-hard and run kill -9 7668. Ok, it’s done with one click and you can restart the server.