Learn how to quickly kill a stuck Next.js development server on port 3000 with a simple command.
•2 min read
TL;DR - Quick Fix
Just run this in your terminal:
lsof -t -i tcp:3000 | xargs kill
Ever encountered the dreaded Error: listen EADDRINUSE: address already in use :::3000 when trying to start your Next.js development server? Here's a quick solution to add to your package.json scripts.
The Problem
When developing with Next.js, sometimes the development server doesn't shut down properly, leaving port 3000 occupied. This commonly happens when:
Your terminal crashes unexpectedly
You force-quit the development process
A previous session is still running in the background