{"id":18498,"library":"lite-server","title":"lite-server","description":"Lightweight development-only Node.js server for SPAs, wrapping BrowserSync with automatic HTML5 history API fallback, live reload, and CSS injection via WebSocket. Version 2.6.1 (latest) as of 2023, maintained infrequently (last release 2021). Key differentiator: integrates BrowserSync with connect-history-api-fallback middleware out of the box, solving deep-linking for Angular/React/Vue SPAs with minimal config. Unlike plain BrowserSync, it defaults to serving index.html for unknown routes. Primarily used via npm scripts or npx, supports custom BrowserSync config via bs-config.json/js.","status":"maintenance","version":"2.6.1","language":"javascript","source_language":"en","source_url":"https://github.com/johnpapa/lite-server","tags":["javascript","angular","spa","static","server","development"],"install":[{"cmd":"npm install lite-server","lang":"bash","label":"npm"},{"cmd":"yarn add lite-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add lite-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core server providing live reload, CSS injection, WebSocket sync","package":"browser-sync","optional":false},{"reason":"Middleware for HTML5 history API fallback to index.html","package":"connect-history-api-fallback","optional":false},{"reason":"CLI argument parsing for --config, --baseDir, etc.","package":"yargs","optional":false}],"imports":[{"note":"Use as CLI tool, not programmatic API. Install locally and run via npm script.","wrong":"npm run lite-server without script entry","symbol":"lite-server (CLI)","correct":"npx lite-server"},{"note":"Config file must be CommonJS (bs-config.js) or JSON (bs-config.json). ESM not supported.","wrong":"export default { ... } (ESM syntax not supported)","symbol":"bs-config (module.exports)","correct":"module.exports = { server: { baseDir: './src' } }"},{"note":"Use -c or --config= for config file, --baseDir= for base directory.","wrong":"lite-server --config my-config.js --basedir=dist (typo in baseDir)","symbol":"CLI options","correct":"lite-server -c my-config.js --baseDir=dist"}],"quickstart":{"code":"{\n  \"scripts\": {\n    \"dev\": \"lite-server\"\n  }\n}\n// Then run: npm install lite-server --save-dev && npm run dev","lang":"javascript","description":"Basic setup: add lite-server to package.json scripts as 'dev', install locally, then run with npm run dev."},"warnings":[{"fix":"Use a proper production server like Express, Nginx, or serve-static.","message":"lite-server is intended for development only; do not use in production.","severity":"gotcha","affected_versions":"*"},{"fix":"Use module.exports = { ... } in bs-config.js.","message":"Config file must be CommonJS (module.exports) for .js files; ESM (export default) not supported.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Monitor dependencies manually or use Dependabot/Renovate.","message":"Greenkeeper badge in README refers to deprecated service; project may not have active dependency updates.","severity":"deprecated","affected_versions":"*"},{"fix":"Run from project root or use --baseDir='dist'","message":"Default base directory is current working directory; ensure index.html exists or specify with --baseDir.","severity":"gotcha","affected_versions":"*"},{"fix":"Use absolute or correct relative path.","message":"When using --baseDir CLI option, ensure path is relative to current working directory.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider alternatives like Vite, webpack-dev-server, or @angular-devkit/build-angular if issues arise.","message":"The library is in maintenance mode with no active development; newer versions may not be released.","severity":"breaking","affected_versions":">=2.6.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure lite-server is installed correctly; try 'npm install lite-server --save-dev'.","cause":"Missing dependency; lite-server installs browser-sync as a dependency, but npm may fail.","error":"Error: Cannot find module 'browser-sync'"},{"fix":"Check bs-config.js has module.exports = { ... }; for JSON file, ensure valid JSON.","cause":"Config file uses invalid syntax or missing exports.","error":"TypeError: Cannot read property 'indexOf' of undefined"},{"fix":"Specify a different port in bs-config.json: { \"port\": 8080 }","cause":"Default port 3000 already in use by another process.","error":"Error: listen EADDRINUSE :::3000"},{"fix":"Set correct baseDir in config or use --baseDir pointing to folder with index.html.","cause":"Base directory does not contain index.html.","error":"Error: No such file or directory: '/path/to/project/index.html'"},{"fix":"Reinstall lite-server: npm install lite-server --save-dev","cause":"Missing dependency; lite-server may not install correctly.","error":"Error: Cannot find module 'connect-history-api-fallback'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}