V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
meisen
V2EX  ›  问与答

搭建博客出现 port 4000 has been used 如何解决?

  •  
  •   meisen · Jun 16, 2020 · 2682 views
    This topic created in 2141 days ago, the information mentioned may be changed or developed.

    手 jiàn 将 blog 文件夹删除,重新搭建提示 4000 端口被占用

    FATAL Port 4000 has been used. Try other port instead.
    FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/do
    Error: listen EADDRINUSE 0.0.0.0:4000
        at Object.exports._errnoException (util.js:1026:11)
        at exports._exceptionWithHostPort (util.js:1049:20)
    

    网上找到解决办法是在_config.yml 加上代码更改 hexo-server 运行时的端口号,例如 4001

    server:
      port: 4001
      compress: true
      header: true
    

    我其实心理上不愿意这样操作,想学习下如何清除之前的 4000 端口?( Ps 非程序员)

    5 replies    2020-06-16 15:29:01 +08:00
    vakara
        1
    vakara  
       Jun 16, 2020 via Android   ❤️ 1
    lsof -i:4000 看具体的进程。
    Jirajine
        2
    Jirajine  
       Jun 16, 2020 via Android
    直接重启
    wellsc
        3
    wellsc  
       Jun 16, 2020
    字面意思已经告诉你了,4000 端口被占用了呢
    U7Q5tLAex2FI0o0g
        4
    U7Q5tLAex2FI0o0g  
       Jun 16, 2020
    你都知道“端口被占用”了,拿这 5 个字百度一下,详细的做法包括 windows 、linux 都会跟你说。
    简单来说无非就是:
    1 、找到占用端口的进程
    2 、杀死进程(如果有需要的话)
    meisen
        5
    meisen  
    OP
       Jun 16, 2020
    @vakara #1
    @Jirajine #2
    @wellsc #3
    @littleylv #4

    已解决,感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1223 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 17:51 · PVG 01:51 · LAX 10:51 · JFK 13:51
    ♥ Do have faith in what you're doing.