Registry / http-networking / static-cling

static-cling

JSON →
library2.0.3jsnpmunverified

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.

npm install static-cling
INSTALL
IMPORT
SIG · STATIC-CLING
S
static-cling
http-networkingjavascriptv2.0.3
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ const cling = require('static-cling'); cling();
✗ import cling from 'static-cling';
Package uses CommonJS, not ESM. Use require.
default with options
✓ require('static-cling')({ port: 8080, root: './public' });
✗ require('static-cling').serve({ port: 8080 });
Directly call the returned function with options. No named export.
CLI usage
✓ static -p 4000 -d ./dist
✗ npx static
CLI installed globally via npm i -g static-cling. Use flags only; positional args ignored.

Shows how to start a static file server programmatically with custom port, root, and default file.

const cling = require('static-cling'); cling({ port: process.env.PORT || 3000, root: './public', filename: 'index.html' });
static-cling --version
Debug
Known issues
gotchaCLI command is just 'static', which may conflict with other tools. Ensure global install and no name collision.
fix
Use --global flag during npm install; check for conflicting binaries with 'which static'.
affects: all
deprecatedPackage last updated in 2019; no maintenance or security patches.
fix
Consider alternatives like 'http-server' or 'serve' for active support.
affects: >=2.0.0
gotchaDoes not support HTTPS, caching, or directory listing by default.
fix
Use reverse proxy (e.g., nginx) or switch to a feature-rich server.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'static-cling'
Package not installed or not in node_modules.
fix
npm install static-cling --save
static: command not found
Package not installed globally or PATH issue.
fix
npm install -g static-cling
Upgrade
Version history
2.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
static-cling — npm install static-cling · libregistry