How can I resolve a port already in use error when running 'npm run dev' in Next.js?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I resolve a port already in use error when running 'npm run dev' in Next.js?
Asked by:
84 Viewed 84 Answers

Answer (84)

Best Answer
(255)
If another process is using port 3000 (the default), you can either identify and terminate that process, or configure Next.js to use a different port. To change the port, modify the `port` property in your `next.config.js` file. For example: `port: 3001`.