启动express项目报错:
root@ubuntuServerVM:/home/nodejs/meadowlark/site# node meadowlark.js
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at Server._listen2 (net.js:1259:14)
at listen (net.js:1295:10)
at Server.listen (net.js:1391:5)
解决办法:
找到占用端口的node进程: ps -aux | grep node
root@ubuntuServerVM:/home/nodejs/meadowlark/site# ps -aux | grep node root 7714 0.0 3.7 921448 37312 pts/0 Tl 13:52 0:00 node meadowlark.js root 7862 0.0 2.4 645152 24916 pts/0 Tl 14:40 0:00 node root 8095 0.0 0.0 12944 900 pts/0 S+ 15:10 0:00 grep --color=auto node
强制结束该进程:kill -s 9 7714
再次运行express项目,成功了。