Cursor Skill

detecting-port-conflicts

Detect EADDRINUSE and port conflicts, find what's using the port, and resolve it by killing the process or suggesting an alternative port.

LLM Mart · 0 points · 21 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download spencerpauly-awesome-cursor-skills-resources_detecting-port-conflicts-99cd265.zip · 0 KB
Part of spencerpauly/awesome-cursor-skills — 65 skills

Install

skills CLI npx skills add https://github.com/spencerpauly/awesome-cursor-skills/tree/main/resources/detecting-port-conflicts
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install spencerpauly-awesome-cursor-skills@llmmart
Git git clone https://github.com/spencerpauly/awesome-cursor-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole spencerpauly/awesome-cursor-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Detecting Port Conflicts

When a dev server fails to start because a port is already in use, diagnose and resolve it.

Detection

Scan terminal output for these patterns:

  • EADDRINUSE
  • address already in use
  • Port XXXX is already in use
  • bind: address already in use
  • OSError: [Errno 98] Address already in use

Extract the port number from the error message.

Diagnosis

Find what's using the port:

lsof -i :<PORT> -P -n

This shows the PID, process name, and user. Common culprits:

  • A previous dev server that didn't shut down cleanly
  • Another project's dev server
  • A Docker container
  • A system service

Resolution Options

Option 1: Kill the blocking process

kill <PID>
# If it doesn't stop:
kill -9 <PID>

Then restart the original server.

Option 2: Use a different port

Suggest the next available port:

# Check if port+1 is free
lsof -i :<PORT+1> -P -n

Update the dev server config or start command:

  • Next.js: next dev -p <PORT>
  • Vite: vite --port <PORT>
  • Express: set PORT env var
  • Django: python manage.py runserver <PORT>

Option 3: Kill all node processes (nuclear option)

killall node

Only suggest this if the user confirms — it kills everything.

Tips

  • On macOS, ports below 1024 require root
  • Docker containers bind ports that persist even if the container is stopped — check docker ps
  • If lsof shows nothing, the port may be in TIME_WAIT state — just wait 30 seconds or use a different port
Files (awesome-cursor-skills)
  • SKILL.md 1.7 KB
    ---
    name: detecting-port-conflicts
    description: Detect EADDRINUSE and port conflicts, find what's using the port, and resolve it by killing the process or suggesting an alternative port.
    user-invocable: true
    ---
    
    # Detecting Port Conflicts
    
    When a dev server fails to start because a port is already in use, diagnose and resolve it.
    
    ## Detection
    
    Scan terminal output for these patterns:
    - `EADDRINUSE`
    - `address already in use`
    - `Port XXXX is already in use`
    - `bind: address already in use`
    - `OSError: [Errno 98] Address already in use`
    
    Extract the port number from the error message.
    
    ## Diagnosis
    
    Find what's using the port:
    
    ```bash
    lsof -i :<PORT> -P -n
    ```
    
    This shows the PID, process name, and user. Common culprits:
    - A previous dev server that didn't shut down cleanly
    - Another project's dev server
    - A Docker container
    - A system service
    
    ## Resolution Options
    
    ### Option 1: Kill the blocking process
    
    ```bash
    kill <PID>
    # If it doesn't stop:
    kill -9 <PID>
    ```
    
    Then restart the original server.
    
    ### Option 2: Use a different port
    
    Suggest the next available port:
    
    ```bash
    # Check if port+1 is free
    lsof -i :<PORT+1> -P -n
    ```
    
    Update the dev server config or start command:
    - Next.js: `next dev -p <PORT>`
    - Vite: `vite --port <PORT>`
    - Express: set `PORT` env var
    - Django: `python manage.py runserver <PORT>`
    
    ### Option 3: Kill all node processes (nuclear option)
    
    ```bash
    killall node
    ```
    
    Only suggest this if the user confirms — it kills everything.
    
    ## Tips
    
    - On macOS, ports below 1024 require root
    - Docker containers bind ports that persist even if the container is stopped — check `docker ps`
    - If `lsof` shows nothing, the port may be in TIME_WAIT state — just wait 30 seconds or use a different port
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related