Jekyll serve error: address already in use - bind(2) for 127.0.0.1:4000

less than 1 minute read

Problem

After unexpectedly reload vscode for updating vscode,
as I served jekyll from local host by bundle exec jekyll serve,
jekyll 3.9.1 | Error: Address already in use - bind(2) for 127.0.0.1:4000 pops up.

jekyll 3.9.1 | Error: Address already in use - bind(2) for 127.0.0.1:4000:
the port 4000 is already in use meaning that the process is not killed yet by closing the vscode terminal.

Solution

  1. kill the process by finding process id (PID)
    • find pid using port 4000 (lsof: list open files)
       $ lsof -wni tcp:4000
      
    • kill it
       kill -9 your_PID
      
  2. Set another port as jekyll serve --port 4001.

Unix, Linux μ—μ„œ kill λͺ…λ Ήμ–΄λ‘œ μ•ˆμ „ν•˜κ²Œ ν”„λ‘œμ„ΈμŠ€ μ’…λ£Œ μ‹œν‚€λŠ” 방법

https://www.lesstif.com/system-admin/unix-linux-kill-12943674.html

kill -9 둜 signal 을 보내면 κ°œλ°œμžκ°€ κ΅¬ν˜„ν•œ μ’…λ£Œ ν•¨μˆ˜κ°€ ν˜ΈμΆœλ˜μ§€ μ•Šκ³  μ¦‰μ‹œ ν”„λ‘œμ„ΈμŠ€κ°€ μ’…λ£Œλ˜μ–΄ λ²„λ¦¬λ―€λ‘œ 데이타가 μœ μ‹€λ˜κ±°λ‚˜ λ¦¬μ†ŒμŠ€κ°€ μ œλŒ€λ‘œ μ•ˆ λ‹«νžˆλŠ” 큰 λ¬Έμ œκ°€ λ°œμƒν•  수 μžˆμŠ΅λ‹ˆλ‹€.

개인적으둜 μΆ”μ²œν•˜λŠ” 방법은 λ¨Όμ € kill -TERM PID λ‚˜ kill -INT PID 같이 μ’…λ£Œλ₯Ό μ˜λ―Έν•˜λŠ” signal 을 μ—¬λŸ¬ 번 전솑해 μ£ΌλŠ” 것이며 μ œλŒ€λ‘œ 된 ν”„λ‘œκ·Έλž¨μ€ 보톡 cleanup μ½”λ“œλ₯Ό μˆ˜ν–‰ν•˜κ³  μ’…λ£Œν•˜κ²Œ λ©λ‹ˆλ‹€.

Leave a comment