# Address already in use ์—๋Ÿฌ ํ•ด๊ฒฐ

Error: listen EADDRINUSE: address already in use :::5000
1

์ด ์—๋Ÿฌ๋Š” ํ˜„์žฌ ์ž‘์—…์ค‘์ธ ํ”„๋กœ์ ํŠธ ํŒŒ์ผ์ด ๋‹ค๋ฅธ ํ”„๋กœ์ ํŠธ ํŒŒ์ผ์—์„œ ์ด๋ฏธ ์‚ฌ์šฉ์ค‘์ธ ํŠน์ • ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋ ค ํ•  ๋•Œ ๋‚˜ํƒ€๋‚˜๋Š” ์—๋Ÿฌ์ด๋‹ค. ์ฆ‰, address already in use :::5000 ์ด๋ผ๋ฉด 5000๋ฒˆ ํฌํŠธ๊ฐ€ ํ˜„์žฌ ๋‹ค๋ฅธ ํ”„๋กœ์„ธ์Šค์—์„œ ์‚ฌ์šฉ์ค‘์ด๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹น ํฌํŠธ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์—†๋‹ค๋Š” ์˜๋ฏธ์ด๋‹ค.

# ํ•ด๊ฒฐ๋ฐฉ๋ฒ•

5000๋ฒˆ ์„œ๋ฒ„๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ์ฐพ์•„ ์™„์ „ํžˆ ์ข…๋ฃŒ์‹œํ‚จ๋‹ค.

# 1. 5000๋ฒˆ ํฌํŠธ๋ฅผ ์‚ฌ์šฉ์ค‘์ธ ํ”„๋กœ์„ธ์Šค ์ฐพ๊ธฐ

์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ํ”„๋กœ์„ธ์Šค์˜ PID ๊ฐ’์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

sudo lsof -i :5000
1

# 2. ํ”„๋กœ์„ธ์Šค์˜ PID ๊ฐ’์„ ๊ฐ•์ œ์ข…๋ฃŒ

-9๋Š” kill์˜ ๊ฐ•์ œ ์ข…๋ฃŒ ์‹œ๊ทธ๋„์ธ 9 ๋ฒˆ์„ ์‚ฌ์šฉํ•œ๋‹ค๋Š” ์˜๋ฏธ

sudo kill -9 (PID)
1

์ด์ œ ์ •์ƒ์ ์œผ๋กœ 5000๋ฒˆ ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

# ๋‚ด์šฉ ์ถ”๊ฐ€ 22.04.20

์ž‘์—…์ค‘ ํ•ด๋‹น ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•ด ์ด๋ฒˆ์—๋„ ์—ญ์‹œ ์œ„์™€ ๊ฐ™์€ ๋ฐฉ๋ฒ•์œผ๋กœ ํ•ด๊ฒฐ์„ ์‹œ๋„ํ–ˆ๋‹ค.
sudo lsof -i:port ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด๋„ ์‚ฌ์šฉ์ค‘์ธ ์„œ๋ฒ„๊ฐ€ ์—†๋‹ค(๋ชฉ๋ก์ด ๋œจ์ง€ ์•Š์Œ). ๊ตฌ๊ธ€๋ง ๊ฒฐ๊ณผ ์ด ํŽ˜์ด์ง€ (opens new window)๋ฅผ ๋ฐœ๊ฒฌํ–ˆ๋Š”๋ฐ, ํ•ด๋‹น ์—๋Ÿฌ๋Š” MacOS Monterey ๋ฒ„์ „์—์„œ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๋ผ๊ณ  ํ•œ๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ ๊ฐ„๋‹จํ–ˆ๋‹ค.

Mac ํ™˜๊ฒฝ์„ค์ • โ†’ ๊ณต์œ  โ†’ AirPlay ์ˆ˜์‹ ๋ชจ๋“œ๋ฅผ ์ฒดํฌํ•ด์ œํ•œ๋‹ค.

node ๋ฅผ ์‹คํ–‰ํ•ด๋ดค๋‹ค. ์—๋Ÿฌ๊ฐ€ ๋ง๋”ํžˆ ์—†์–ด์ง„ ๊ฒƒ์„ ํ™•์ธํ–ˆ๋‹ค.

Last Updated: 2022. 6. 5. ์˜คํ›„ 3:42:39