ļģž

localhost:5173 - Vite Development Server Port Guide


Updated on May 21, 2026

localhost:5173

Vite Development Server Port

⚡ Open localhost:5173

Vite's default dev server, with HMR over native ES modules

localhost:5173 is the address Vite’s dev server binds to by default when you run npm run dev. localhost resolves to 127.0.0.1 (your machine), and 5173 is the port Vite picked back in v2.7 to dodge collisions with Create React App on 3000 and friends.

There’s a small joke in the number itself: 5-1-7-3 reads as V-I-T-E if you squint at a phone keypad. Cute, but the reason most frontend projects you touch in 2026 land on this port is more boring - Vite is the default dev server for almost every modern framework.

As of 2026, Vite 8 ships with Rolldown, a Rust-based bundler that replaces the old Rollup + esbuild split. Production builds are 1.6x to 7.7x faster than Vite 7 on real codebases (Linear reported 46s -> 6s; Ramp -57%; Beehiiv -64%). Plugin API compatibility was preserved, but some Rollup plugins that reach into internals still need updates - check before upgrading large monorepos. The dev server on localhost:5173 works the same as before, though under the hood it now uses the Environment API (introduced in Vite 6) to handle client, SSR, and edge runtimes as separate, configurable environments - the foundation TanStack Start, Nuxt, and SvelteKit build on for unified dev/prod parity. Around it, the ecosystem has picked up TanStack Start (full-stack React on Vite, v1 RC since early 2026), Vite+ (VoidZero’s integrated toolchain), and coding agents like Claude Code and Cursor that drive the Vite server for browser automation.


Services and Software That Use Port 5173

Port 5173 is primarily used by Vite and Vite-powered applications across the modern frontend ecosystem. Here are the main applications:

⚡ Vite-Powered Frameworks

  • TanStack Start: Full-stack React (and Solid) on Vite. v1 RC since early 2026 - production-usable, ecosystem still filling in
  • Vue.js 3: Default scaffold (npm create vue@latest) wires up Vite
  • React: Vite is the React team's recommended starter since CRA was retired in 2025
  • SvelteKit: Svelte's full-stack framework, Vite-powered
  • Astro: Content-first static + island architecture, built on Vite
  • Nuxt 3: Vue's full-stack framework on Vite + Nitro
  • Remix: Full-stack React, Vite-based since v2
  • Qwik: Resumability-focused framework, Vite under the hood
  • Solid.js: Fine-grained reactive runtime, ships a Vite template
  • Analog: Angular meta-framework on Vite
  • Waku: Minimal React Server Components framework on Vite
  • Lit: Web components library, works cleanly with Vite
  • Preact: 3KB React alternative with a Vite template

đŸ› ī¸ Development Tools

  • Vite 8 Dev Server: The actual process listening on 5173. v8 ships Rolldown as the bundler (10x to 30x faster builds vs Rollup)
  • Vite+: VoidZero's integrated toolchain bundling Vite, Vitest, Rolldown, and Oxc behind one CLI
  • Vitest: Vite-native unit test runner; reuses your vite.config.js
  • TanStack DevTools: Unified devtools panel for Query / Router / Form / Start, installed as a Vite plugin
  • Storybook: Runs on Vite as its builder (Storybook 7+)
  • Playwright / Cypress: E2E runners that point at the Vite dev URL
  • AI coding agents: Cursor, Claude Code, and similar tools commonly start Vite with server.open: false + strictPort: true so the URL is predictable for headless browser steps
  • MSW: Mock Service Worker - intercepts fetch during dev so you can build against an API that doesn't exist yet
  • vite-plugin-pwa: Drops a service worker and manifest into your build; works on 5173 in dev with devOptions.enabled: true
  • Oxc / Biome: Rust-based lint/format toolchains; Oxc now powers @vitejs/plugin-react-oxc for faster transforms
  • Hono: Edge-first web framework with first-class Vite integration (@hono/vite-dev-server) for full-stack apps on a single port
  • Vite plugins: Anything from vite-plugin-svelte to @vitejs/plugin-react-oxc

📱 Modern Web Applications

  • Single Page Applications (SPAs): Full-featured apps that run entirely in the browser
  • Progressive Web Apps (PWAs): Offline-capable apps with app-like experience
  • TypeScript Projects: Full type safety out of the box
  • Vanilla JavaScript: No framework needed, just modern ES modules
  • Web Components: Reusable custom HTML elements
  • Mobile Apps: iOS/Android apps with Capacitor or Tauri

🎨 Frontend Tooling

  • CSS Frameworks: Tailwind CSS, UnoCSS, Sass
  • Component Libraries: Build and test UI components with live reload
  • Micro-frontends: Module federation for composable apps
  • Documentation Sites: VitePress, Dumi for docs
  • Design Systems: Build and maintain component systems
  • Blog Generators: Astro for content-heavy sites

Run npm run dev, yarn dev, or pnpm dev and Vite starts on 5173 with no config. You get cold-start in tens of milliseconds (vs ~10s for CRA on a comparable app), HMR over a WebSocket on the same port, native ESM in the browser, dependency pre-bundling via esbuild on first run, and zero-config TypeScript transpilation (note: not type-checking - run tsc --noEmit separately or via Vitest).


How to Troubleshoot Localhost:5173

When the dev server isn’t reachable on 5173, it’s almost always one of four things:

🔍 Step 1: Make Sure Vite is Actually Running

The Fix: Fire up your dev server if it's not already going.

What to do:

  • Start Vite: npm run dev, yarn dev, or pnpm dev
  • Check terminal: Look for "Local: http://localhost:5173/" message
  • Verify project setup: Ensure you're in a Vite project directory
  • Check package.json: Verify dev script is configured correctly

đŸšĢ Step 2: Free Up Port 5173

The Fix: Port 5173 is already taken by something else.

Quick wins:

  • Find conflicting process: lsof -i :5173 (Linux/macOS) or netstat -ano | findstr :5173 (Windows)
  • Stop the process: kill -9 <PID>
  • Use different port: npm run dev -- --port 5174

🔧 Step 3: Config or Dependency Issues

The Fix: Something's wrong with your setup.

Try these:

  • Check vite.config.js: Verify configuration syntax and plugins
  • Install dependencies: npm install or yarn install
  • Clear cache: Remove node_modules/.vite directory

🌐 Step 4: Verify It's Working

The Fix: Test if your server is actually reachable.

Check it:

  • Browser: Navigate to http://localhost:5173
  • Command line: curl http://localhost:5173
  • Network access: Use npm run dev -- --host for external access

Port behavior worth knowing

A few things about how Vite handles 5173 that trip people up:

  • It auto-increments. If 5173 is taken, Vite silently picks 5174, then 5175, and so on. Useful when running two projects at once, annoying when scripts or browser bookmarks assume 5173. Lock it with server.strictPort: true in vite.config.js (or --strictPort on the CLI) and Vite will exit instead.
  • vite dev and vite preview are different ports. Dev runs on 5173. vite preview (which serves your production dist/ for smoke-testing) defaults to 4173. They’re different processes serving different bundles - don’t share state between them.
  • --host exposes you on the LAN. Without it, Vite binds to 127.0.0.1 and is reachable only from your machine. With --host (or server.host: true), it binds to 0.0.0.0 - now anyone on the same Wi-Fi can hit your dev server. Fine at home, less fine on a hotel or coffee-shop network.
  • allowedHosts is enforced. Since Vite 6, requests with a Host header outside server.allowedHosts are rejected with a 403. This matters when proxying through a tunnel or a reverse proxy - add the public hostname or set it to true for dev.
  • Inside Docker, localhost isn’t your host. Inside a container, localhost is the container itself. Run Vite with --host 0.0.0.0, expose 5173 in your Dockerfile/compose, and visit http://localhost:5173 from the host - it’ll forward in. For HMR, you may also need server.hmr.host set to the host name the browser uses.
  • HTTPS on localhost takes a plugin. Vite has server.https, but generating a trusted cert is the painful part. vite-plugin-mkcert automates this (uses mkcert under the hood) and is the standard answer when you need HTTPS for OAuth callbacks, PWAs, or anything that requires a secure context.

Access localhost:5173 from Other Devices

localhost only resolves on the machine running Vite, so a phone on the same Wi-Fi or a teammate on the other side of the office can’t hit it directly. Two options: bind Vite to your LAN IP (npm run dev -- --host then visit http://<your-ip>:5173), or open a tunnel for anyone on the internet. For the second case, a one-line Pinggy command works without installing anything:

You’ll get back a public HTTPS URL that proxies to localhost:5173. Useful for sharing a WIP build with a client, testing on iOS Safari without messing with certs, or pointing a webhook (Stripe, Clerk, GitHub) at a local handler. Heads-up: Vite’s HMR runs over WebSockets, and depending on your vite.config.js you may need to set server.hmr.clientPort: 443 and add the tunnel host to server.allowedHosts for hot reload to keep working over the tunnel.


Common Problems and Solutions

Here are typical issues with localhost:5173 and how to resolve them:

❌ "Port Already in Use" Error

You'll see: "Port 5173 is in use..."

Quick fix: lsof -i :5173 to find who's using it, kill -9 <PID> to kill it, or just switch ports with npm run dev -- --port 5174

âš ī¸ Vite Server Won't Start

You'll see: Errors during startup or fails immediately

Quick fix: npm install to reinstall deps, check vite.config.js for typos, or nuke node_modules/.vite cache

🔄 HMR Not Working (Changes Don't Auto-Reload)

You'll see: Save a file but browser doesn't update

Quick fix: Check browser console for WebSocket errors, make sure your IDE is watching files, or just restart Vite

🌐 Can't Access from Other Machines on Network

You'll see: Works on localhost but not from phone or other PC

Quick fix: npm run dev -- --host then access via your machine's IP like http://192.168.1.100:5173

🐌 Slow Initial Load or Server Startup

You'll see: Takes forever to start or first page load is sluggish

Quick fix: rm -rf node_modules package-lock.json && npm install, remove the node_modules/.vite folder, or optimize dependencies in vite.config.js

🔌 Plugin Errors

You'll see: Vite starts but complains about a plugin

Quick fix: Check plugin versions match your Vite version, verify the config is correct, and update plugins with npm update

🔄 HMR Disconnects Behind a Tunnel or Reverse Proxy

You'll see: Page loads fine, but the console shows WebSocket connection to 'wss://...:5173' failed and edits don't hot-reload

Quick fix: Vite's client tries to open the WebSocket on port 5173, but tunnels/proxies only expose 443. Set server.hmr.clientPort: 443 (and server.hmr.protocol: 'wss' if needed) in vite.config.js, and add the public host to server.allowedHosts.

đŸ“Ļ Monorepo: "The request url ... is outside of Vite serving allow list"

You'll see: Importing a sibling package in a pnpm/npm workspace 403s with that error

Quick fix: Add the workspace root (or the specific package paths) to server.fs.allow in your vite.config.js. Default is the project root only; in a monorepo, Vite refuses to serve files above it for security.


Summary

  • What it is: localhost:5173 is Vite’s default dev server address (127.0.0.1 on TCP 5173).
  • Who uses it: Every Vite-based stack - Vue, React, Svelte, Astro, Nuxt, TanStack Start, Solid, Qwik, Analog, Waku, plus Vitest and Storybook in dev.
  • First debug step: lsof -i :5173 to see what’s bound, then npm run dev and watch the terminal for the “Local: http://localhost:5173/” line.
  • Common fixes: kill whatever owns the port, pass --port 5174, wipe node_modules/.vite, or use --host to expose it on your LAN.

🚀 Quick Start Commands

# Vue
npm create vue@latest my-app && cd my-app && npm install

# React (Vite template)
npm create vite@latest my-app -- --template react-ts

# TanStack Start (full-stack React on Vite)
npm create @tanstack/start@latest my-app

# Same scaffold with Bun (faster install)
bunx create-vite@latest my-app --template svelte-ts

# Start dev server (binds to localhost:5173)
npm run dev

Use these commands to quickly get started with Vite on localhost:5173

If you’ve worked with frontend tooling in the last few years, 5173 is probably one of the more memorable numbers in your shell history. It’s not magic - it’s just the port Vite picked, and Vite happens to be what most frameworks now ship as their dev server. Knowing how to find what’s bound to it, how to move off it, and how to expose it safely covers 90% of what you’ll ever need.