Hexo--hexo server失败,提示端口被占用

FATAL Port 4000 has been used. Try other port instead.

我们在用Hexo写博客的时候,偶尔会遇到上面这类错误:4000端口被占用,请用其他端口尝试

这个问题,往往是因为我们没有正确关闭上一次的Hexo server操作,导致Node进程还在后台执行,并占用4000

1
2
3
4
5
6
7
8
$ hexo server
FATAL Port 4000 has been used. Try other port instead.
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: listen EADDRINUSE: address already in use 0.0.0.0:4000
at Server.setupListenHandle [as _listen2] (net.js:1258:14)
at listenInCluster (net.js:1306:12)
at doListen (net.js:1445:7)
at process.internalTickCallback (internal/process/next_tick.js:72:19)

解决办法:

windows任务管理器 – 进程 – 找到 ‘Node.js’ 为前缀的进程名,然后主动关闭进程即可

坚持原创技术分享,谢谢鼓励我继续创作!