{"id":22409,"library":"static-cling","title":"Static Cling","description":"A minimal static file server for Node.js, version 2.0.3, providing both a command-line interface and programmatic usage. It serves files from a directory with optional custom port, root path, and default filename. Last updated in 2019, it has low maintenance cadence. Differentiators: extremely simple setup with no dependencies (pure Node.js http module), suitable for quick local development or demonstrations. Alternatives like http-server or serve offer more features and active maintenance.","status":"maintenance","version":"2.0.3","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/Kevnz/Static-Cling","tags":["javascript","webserver","fileserver"],"install":[{"cmd":"npm install static-cling","lang":"bash","label":"npm"},{"cmd":"yarn add static-cling","lang":"bash","label":"yarn"},{"cmd":"pnpm add static-cling","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses CommonJS, not ESM. Use require.","wrong":"import cling from 'static-cling';","symbol":"default","correct":"const cling = require('static-cling'); cling();"},{"note":"Directly call the returned function with options. No named export.","wrong":"require('static-cling').serve({ port: 8080 });","symbol":"default with options","correct":"require('static-cling')({ port: 8080, root: './public' });"},{"note":"CLI installed globally via npm i -g static-cling. Use flags only; positional args ignored.","wrong":"npx static","symbol":"CLI usage","correct":"static -p 4000 -d ./dist"}],"quickstart":{"code":"const cling = require('static-cling');\ncling({ port: process.env.PORT || 3000, root: './public', filename: 'index.html' });","lang":"javascript","description":"Shows how to start a static file server programmatically with custom port, root, and default file."},"warnings":[{"fix":"Use --global flag during npm install; check for conflicting binaries with 'which static'.","message":"CLI command is just 'static', which may conflict with other tools. Ensure global install and no name collision.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider alternatives like 'http-server' or 'serve' for active support.","message":"Package last updated in 2019; no maintenance or security patches.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use reverse proxy (e.g., nginx) or switch to a feature-rich server.","message":"Does not support HTTPS, caching, or directory listing by default.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install static-cling --save","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'static-cling'"},{"fix":"npm install -g static-cling","cause":"Package not installed globally or PATH issue.","error":"static: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}