解决运行Nodejs代码Error: listen EADDRINUSE
· 备忘笔记 · 0 comment · 587 Views

解决运行Nodejs代码Error: listen EADDRINUSE

· 备忘笔记 · 0 comment · 587 Views
root@xxx:~/hexo# hexo server
[error] Error: listen EADDRINUSE
Error: listen EADDRINUSE
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1039:14)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1135:5)
    at Function.app.listen (/root/.nvm/v0.10.25/lib/node_modules/hexo/node_modules/express/lib/application.js:533:24)
    at /root/.nvm/v0.10.25/lib/node_modules/hexo/lib/plugins/console/server.js:86:9
    at /root/.nvm/v0.10.25/lib/node_modules/hexo/lib/post/load.js:67:7
    at /root/.nvm/v0.10.25/lib/node_modules/hexo/node_modules/async/lib/async.js:116:25
    at /root/.nvm/v0.10.25/lib/node_modules/hexo/node_modules/async/lib/async.js:24:16
    at exports.post (/root/.nvm/v0.10.25/lib/node_modules/hexo/lib/plugins/generator/asset.js:50:3)

原因是Nodejs所监听的端口被占用,查找端口占用的程序并kill掉即可

root@xxxxx:~/hexo# fuser -n tcp 80
80/tcp:                705   715   716   717   718
root@xxxxx:~/hexo# kill 705

有用的就是里面的 fuser -n tcp 80 和 kill 了,就是酱紫!

添加新评论