๐ก Port ๋ฒํธ๊ฐ ์ด๋ฏธ ์ฌ์ฉ๋๊ณ ์์ผ๋ฏ๋ก ๋ค๋ฅธ port ๋ฒํธ๋ฅผ ์ฌ์ฉํ๋ผ๋ ์๋ฌ๊ฐ ๋ฐ์ํ์๋ค.
์๋ฌ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
server.js
events.js:352
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::8080
at Server.setupListenHandle [as _listen2] (net.js:1320:16)
at listenInCluster (net.js:1368:12)
at Server.listen (net.js:1454:7)
at Function.listen (/Users/lyk/Documents/GitHub/Support/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/Users/lyk/Documents/GitHub/Support/server.js:13:5)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1347:8)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
code: 'EADDRINUSE',
errno: -48,
syscall: 'listen',
address: '::',
port: 8080
}
์์ ๊ฐ์ด 8080์ ์ฐ๋ ค๋ ์๊ฐ ์๋ฌ๊ฐ ๋ฐ์ํ์๋ค. ์ด ์ ์ 8080 port๋ฅผ ์ฌ์ฉํ๋ค๊ฐ ๋น์ ์์ ์ผ๋ก ์ข ๋ฃ์ํจ๊ฑฐ ๊ฐ๋ค.
ํด๊ฒฐ
- 8080 port๋ฅผ ์ฌ์ฉํ๊ณ ์๋ ํ๋ก์ธ์ค์ id๋ฅผ ์์๋ด์ผ ํ๋ค.
sudo lsof -i :8080
๋ฅผ ํตํด ์ ์ ์๋ค.- ์ด์ ์ด ํ๋ก์ธ์ค๋ฅผ ์ฃฝ์ธ๋ค.
sudo kill -9 [pid]
lsof
์ ๊ดํ์ฌlsof
๋ list open files์ ์ฝ์๋ก ์์คํ ์ ์ด๋ ค์๋ ํ์ผ์ ๋ํ ์ ๋ณด๋ฅผ ์ถ๋ ฅํด์ฃผ๋ ๋ช ๋ น์ด๋ค.sudo yum install lsof
๋ฅผ ํตํด ์ค์น๊ฐ ๊ฐ๋ฅํ๋ค- i ์ต์ ์ IPv4๋ก ์คํํ ์์ผ์ ๋ํ ์ ๋ณด๋ค์ด ๋์จ๋ค.