{"id":18791,"library":"sirv-cli","title":"sirv-cli","description":"sirv-cli is a lightweight, zero-config CLI tool for serving static files from any directory. It supports HTTP/2, CORS, ETags, gzip/brotli precompressed files, single-page app fallback, and immutable cache headers. Version 3.0.1 requires Node 18+ and ships native ESM via an exports map. It differs from alternatives like http-server or serve by being minimal, fast, and designed for development previews. Regular releases (2-3 per year) with breaking changes infrequent.","status":"active","version":"3.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/lukeed/sirv","tags":["javascript"],"install":[{"cmd":"npm install sirv-cli","lang":"bash","label":"npm"},{"cmd":"yarn add sirv-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add sirv-cli","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This is a CLI tool, not a library; install globally or use npx.","wrong":"Running the package directly as a script without npx and missing options","symbol":"sirv-cli (CLI)","correct":"npx sirv-cli [dir]"}],"quickstart":{"code":"npm install -g sirv-cli\nsirv --port 8080 --dev\n# Navigate to http://localhost:8080","lang":"javascript","description":"Install sirv-cli globally and start a dev server on port 8080."},"warnings":[{"fix":"Upgrade Node.js to version 18 or later.","message":"Node 18+ required since v3.0.0","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Update scripts or explicitly use --port 5000 if needed.","message":"Default port changed from 5000 to 8080 in v2.0.0 due to macOS Monterey reserving port 5000 for AirPlay","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use HTTPS with a reverse proxy for HTTP/2 in production.","message":"HTTP/2 support requires Node 8.4+ but v3 requires Node 18+; --http2 flag still accepted but may be removed in future","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Unset environment variables or use flags exclusively.","message":"HOST and PORT environment variables override --host and --port flags","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add --host flag to allow network access.","message":"By default server is only accessible on localhost (not network); use --host to expose","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use a different port with --port or kill the process using the current port.","cause":"Port 8080 already in use by another process","error":"Error: listen EADDRINUSE :::8080"},{"fix":"Run 'npm install -g sirv-cli' or 'npx sirv-cli'.","cause":"sirv-cli not installed","error":"Error: Cannot find module 'sirv-cli'"},{"fix":"Install globally with 'npm install -g sirv-cli' or use npx.","cause":"sirv-cli not installed globally or not in PATH","error":"sirv: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}