Recently, I encountered this error in my mac development while preparing Angularjs +node.js demo, 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, I found a solution in stackoverflow. This is mainly because the node.js server process was still running and not closed the 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
From the output, we can see that the process PID7668 is in use, so we must kill this stubborn person and run kill -9 7668. Ok, and you can restart the server with one click.
Through this article, I hope it can help friends who encounter such problems. Thank you for your support to this site!