serve-build
raw JSON → 0.1.0 verified Sat Apr 25 auth: no javascript
A minimal static file server for serving a build directory (e.g., after a build step) on a local port. Version 0.1.0 is the only release. No active maintenance or updates. Differentiators: zero-config, single command, no dependencies listed. It simply serves the `build/` folder on port 3000. No support for HTTPS, caching, or custom routes. Alternative to `http-server` or `serve` packages with fewer features.
Common errors
error Error: Cannot find module 'serve-build' ↓
cause Package not installed or global install missing.
fix
Run 'npm install serve-build --save-dev' or 'yarn add serve-build'
error ERR_REQUIRE_ESM ↓
cause Trying to require() an ESM-only package.
fix
Use 'import serveBuild from 'serve-build'' or switch project to ESM.
error EADDRINUSE: address already in use :::3000 ↓
cause Port 3000 is busy by another process.
fix
Kill the process using port 3000 (e.g., 'lsof -ti:3000 | xargs kill') or use a different tool.
Warnings
gotcha Only serves files from the 'build/' subdirectory; not configurable. ↓
fix Ensure your build output is in ./build, or use a more flexible static server like 'serve' or 'http-server'.
gotcha Port is hardcoded to 3000; cannot change via environment variables or CLI flags. ↓
fix If port 3000 is in use, kill the process or use a different tool.
gotcha No HTTPS support; HTTP only. ↓
fix Use a reverse proxy like nginx or a different server for HTTPS.
gotcha ESM-only package; requires Node.js version >= 12 or a bundler/transpiler. ↓
fix Use 'latest' Node or convert project to ESM.
Install
npm install serve-build yarn add serve-build pnpm add serve-build Imports
- serveBuild wrong
const serveBuild = require('serve-build')correctimport serveBuild from 'serve-build'
Quickstart
// Install: npm install serve-build
// Add script to package.json: "start": "serve-build"
// Run: npm start
// Or directly in terminal:
npx serve-build
// Server starts on port 3000 and serves ./build directory