인프런 커뮤니티 질문&답변

김용민님의 프로필 이미지

작성한 질문수

따라하며 배우는 노드, 리액트 시리즈 - 기본 강의

노드 리액트 기초 강의 #3 몽고 DB 연결

에러 질문

21.03.08 01:02 작성

·

158

0

PS C:\Users\min99\Documents\boiler-plate> npm run start

> boiler-plate@1.0.0 start

> node index.js

(node:18000) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency(Use `node --trace-warnings ...` to show where the warning was created)

node:events:304

      throw er; // Unhandled 'error' event

      ^

Error: listen EADDRINUSE: address already in use :::3000

    at Server.setupListenHandle [as _listen2] (node:net:1286:16)

    at listenInCluster (node:net:1334:12)

    at Server.listen (node:net:1420:7)

    at Function.listen (C:\Users\min99\Documents\boiler-plate\node_modules\express\lib\application.js:618:24)  

    at Object.<anonymous> (C:\Users\min99\Documents\boiler-plate\index.js:16:5)

    at Module._compile (node:internal/modules/cjs/loader:1083:30)

    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)

    at Module.load (node:internal/modules/cjs/loader:948:32)

    at Function.Module._load (node:internal/modules/cjs/loader:789:14)

    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)

    at node:internal/main/run_main_module:17:47

Emitted 'error' event on Server instance at:

    at emitErrorNT (node:net:1313:8)

    at processTicksAndRejections (node:internal/process/task_queues:80:21) {

  code: 'EADDRINUSE',

  errno: -4091,

  syscall: 'listen',

  address: '::',

  port: 3000

}

npm ERR! code 1

npm ERR! path C:\Users\min99\Documents\boiler-plate

npm ERR! command failed

npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "node index.js"

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\min99\AppData\Local\npm-cache\_logs\2021-03-07T15_59_57_703Z-debug.log

PS C:\Users\min99\Documents\boiler-plate> 

이러한 에러가 뜨는데 원인이 무엇인가요?

답변 2

1

dev-ujin님의 프로필 이미지

2021. 03. 08. 10:06

강사님은 아니지만 도움이 될까 해서 글 남겨 봅니다!

3000번 포트가 이미 사용중이라고 하네요. 제대로 종료되지 않은 상태에서 다시 요청을 해서 그런 것 같아요.

방법1) index.js 에서 포트 번호를 3000이 아닌 다른 번호로 바꾼다.
방법2) 터미널에서 3000번 포트를 담당하는 프로세스를 종료하고 다시 실행시킨다.
 

0

John Ahn님의 프로필 이미지
John Ahn
지식공유자

2021. 03. 09. 17:25

답변 감사합니다.