| name | local-dev-server |
| description | Local dev server management — start, stop, clean restart, fix cache corruption, port conflicts. Use this skill whenever the dev server needs launching or is misbehaving. |
Local Dev Server
When to Use
- Starting/stopping dev server
- "Address already in use" errors
- Infinite loading spinner / broken pages after build
.next cache corruption (vendor-chunks ENOENT, 404 on static chunks)
- Server crashes and needs restart
- After major code changes or branch switches
Standard Start (Clean)
Always prefer a clean start to avoid stale cache issues:
lsof -ti:3030 | xargs kill -9 2>/dev/null
rm -rf .next
npx next dev -p 3030 &
sleep 8 && curl -s -o /dev/null -w "%{http_code}" http://localhost:3030
First page load after clean start takes ~20-30s to compile. This is normal.
Quick Restart (No Cache Clean)
Only use when you know the cache is fine (small code edits):
lsof -ti:3030 | xargs kill -9 2>/dev/null
npx next dev -p 3030 &
PM2 (Persistent Server)
For long sessions where server should auto-restart on crash:
pm2 start npm --name "empathy-ledger" -- run dev
pm2 restart empathy-ledger
pm2 stop empathy-ledger && rm -rf .next && pm2 start empathy-ledger
pm2 logs empathy-ledger --lines 50
pm2 stop empathy-ledger
Troubleshooting
Infinite spinner / blank page
lsof -ti:3030 | xargs kill -9 2>/dev/null
rm -rf .next
npx next dev -p 3030 &
Port already in use
lsof -ti:3030 | xargs kill -9 2>/dev/null
npx next dev -p 3030 &
API returns 401 when it shouldn't
- Check browser has valid session cookies
- Try logging out and back in at
/auth/signin
- The API auth middleware reads cookies — curl without cookies will always 401
Vendor-chunks ENOENT / 404 on static chunks
rm -rf .next
Verification Checklist
After starting the server, verify:
curl -s -o /dev/null -w "%{http_code}" http://localhost:3030 returns 200 or 307
- Navigate to target page in browser
- Check server logs for compilation errors
Key URLs
Related Skills
deployment-workflow — Production deployment
supabase-connection — Database setup