Next.js Discord

Discord Forum

Why is Nextjs giving me a port already in use error when running dev?

Unanswered
Champagne D’Argent posted this in #help-forum
Open in Discord
Champagne D’ArgentOP
hi. I'm running yarn dev which just runs next dev and I get this error:
yarn dev
 ⨯ Failed to start server
Error: listen EADDRINUSE: address already in use :::4001
    at Server.setupListenHandle [as _listen2] (node:net:1897:16)
    at listenInCluster (node:net:1945:12)
    at Server.listen (node:net:2037:7)
    at /workspace/node_modules/next/dist/server/lib/start-server.js:279:16
    at new Promise (<anonymous>)
    at startServer (/workspace/node_modules/next/dist/server/lib/start-server.js:190:11)
    at /workspace/node_modules/next/dist/server/lib/start-server.js:309:52
    at Span.traceAsyncFn (/workspace/node_modules/next/dist/trace/trace.js:151:26)
    at process.<anonymous> (/workspace/node_modules/next/dist/server/lib/start-server.js:309:35)
    at process.emit (node:events:518:28) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '::',
  port: 4001
}

I'm used to other instances just moving onto another port. why is it not doing this here and/or how to fix this without manually using the -p flag?

0 Replies