npx serve -s build -l 3000

Category: Web App Development

npx serve -s build -l 3000

Serve a built SPA on port 3000 with history fallback

Serves the build folder on port 3000 with the -s single-page flag, which rewrites unknown paths to index.html so client-side routes work on refresh. npx runs the serve package without a permanent install. Add -C to send permissive CORS headers for local API testing.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.