A lightweight CLI static HTTP server with file-watching, custom command execution and live-reload capabilities. Version 2.9.1 (latest as of 2023) is a stable release with no active development cadence; last published 5 years ago. Key differentiators against alternatives like BrowserSync: minimal dependencies (~100KB vs >50MB), no build tool integration required, CLI-only usage designed for npm scripts, and built-in live reload with CSS injection without browser plugins. Supports HTTP/2, proxy, SPA history API fallback, and negative glob patterns. Best suited for static site development needing simple server + reload.
npm install light-serverVerified import paths — ran on the pinned version, not inferred.
Starts a static server on port 4000 serving current directory, watches CSS files and triggers CSS reload without full page refresh.
No fix expected from maintainer; consider switching to a maintained alternative like live-server or http-server with chokidar-cli.
Avoid spaces in watched paths; use Unix-style escaping or change directory structure.
Serve only static HTML during development, or disable live reload and use manual refresh.
Set -s to the actual file directory; use --servePrefix only for URL rewriting.
If you need all requests proxied, use a dedicated proxy tool or configure light-server with --proxypath to selectively proxy.
Ensure .lightserverrc is valid JSON with the same keys as CLI options, e.g., {"serve": ".", "port": 4000}.Check that the directory in the watch expression exists; use absolute paths if possible.
Use a different port with -p, or kill the existing process: lsof -ti:4000 | xargs kill
Run via CLI: npx light-server ... or install globally: npm install -g light-server
Use -p to specify an available port, or stop the process with kill -9 $(lsof -t -i:4000)