Error: listen EADDRINUSE: address already in use :::80 solving in EC2

Seonmi Choi·2021년 8월 28일
0

Start again!!!

목록 보기
27/40
Error: listen EADDRINUSE: address already in use :::80
    at Server.setupListenHandle [as _listen2] (net.js:1280:14)
    at listenInCluster (net.js:1328:12)
    at Server.listen (net.js:1415:7)
    at Function.listen (/home/ubuntu/im-sprint-practice-deploy/server/node_modules/express/lib/application.js:618:24)
    at Object.<anonymous> (/home/ubuntu/im-sprint-practice-deploy/server/app.js:49:5)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Emitted 'error' event at:
    at emitErrorNT (net.js:1307:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server@1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-28T23_31_02_304Z-debug.log

문제 해결 방법 ↓
:sudo를 붙이지 않았을때는 명령어를 읽지 못했다
다시 같은 에러가 났었는데 sudo를 붙이지 않아도 됐었음

ubuntu@ip-172-31-11-150:~/im-sprint-practice-deploy/server$ sudo lsof -i :80 //활성화된 프로세스 리스트를 출력 80번 포트에서 
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
node    31467 root   21u  IPv6 112769      0t0  TCP *:http (LISTEN)
ubuntu@ip-172-31-11-150:~/im-sprint-practice-deploy/server$ sudo kill -9 31467 // kill의 강제종료 시그널인 9번을 사용해서 프로세스아이디(PID)를 삭제
ubuntu@ip-172-31-11-150:~/im-sprint-practice-deploy/server$ sudo npm start

> server@1.0.0 start /home/ubuntu/im-sprint-practice-deploy/server
> node app.js

서버가 80번에서 작동중입니다.
profile
I am not afraid of learning!

0개의 댓글