I spent last week's article checking whether any package registry tells you, before you
install something, that it's going to run code on your machine. This week I got stuck on a
dumber, more basic question: how much stuff, period, am I actually getting? Not "is it
dangerous," just "how big is the invisible part."
Everyone has an opinion on this. "node_modules is a black hole." "lodash is bloated." "is-even
depends on is-odd depends on half the left-pad universe." I've repeated all three myself. None
of them are things I'd actually measured. So I wrote a small script that walks a package
registry's own public JSON — no npm install, no npm ls, no lockfile, nothing downloaded
except the metadata itself — and counts.
The two that surprised me most
lodash has a reputation as the kitchen-sink utility library everyone complains about pulling
into a project "just for one function." Its own registry entry, v4.18.1, lists zero
runtime dependencies. Zero. Whatever you think you're pulling in when you npm install lodash,
it's exactly lodash and nothing else — it's always been this way, lodash has shipped
dependency-free for years, I just never checked.
chalk, the terminal-coloring library almost every CLI tool uses, used to be the textbook
example of a "tiny package with a deep dependency tree" — ansi-styles, supports-color,
has-flag, the works. Current version, 6.0.1: also zero dependencies. It went pure ESM
at some point and dropped the whole chain. I was checking this expecting to confirm the old
reputation and instead confirmed it's just wrong now.
Then the one I was most sure about going in: the is-even meme. You've seen the blog posts —
is-even requires is-odd requires is-number requires a sprawling little empire of
kind-of/is-buffer-style micro-packages, cited for years as the canonical "npm has gone
insane" example. I walked the actual chain today: is-even → is-odd → is-number → nothing.
Three packages total, including itself. is-number rewrote itself as a one-file,
zero-dependency package at some point (it's on major version 7 now) and quietly deflated the
whole joke. The meme is older than the package graph it's mocking.
The one that actually earned its reputation
express. Feels minimal — it's "just" routing and middleware glue. Its current major version,
5.3.0, lists 28 direct dependencies. Walking those recursively — each dependency's own
dependencies, six levels deep — lands on 63 unique packages before the graph stops growing.
That's not outrageous by 2026 standards, but it's a real number for something that feels
like a thin layer, and it's a number you can get in about a second and a half of HTTP requests
against registry.npmjs.org, with nothing installed.
PyPI and crates.io tell a flatter story at the one level I checked directly (I didn't recurse
them — more on why below): requests pulls in 4 mandatory dependencies, flask 7, black 8,
django only 3. serde pulls in 2 crates, regex 4, clap 2. tokio, the async runtime, is
the one outlier there too: 16 dependency rows in its sparse-index entry, though — and this
surprised me on the way there — only 13 are actually unique crate names. The index lists
separate rows for the same dependency (libc, mio) under different platform conditions, and
doesn't collapse them, so a naive .length on that array overcounts unless you dedupe by name
first. I didn't know that about Cargo's own index format until today.
I pulled the npm numbers (and the actor behind the crawl, package-registry-scraper on Apify)
into a reference cheatsheet repo
with the full tables and the crawler script, if you want the receipts or want to point it at
your own stack's dependencies.
Where I'd push back on my own numbers
Three honest gaps, in order of how much they'd move the result:
-
I only recursed npm. PyPI's
requires_distand crates.io'sdeps[]both carry version ranges, not exact pins — to recurse accurately I'd need to actually resolve a dependency graph the waypip/cargodo, including picking a single version when two packages want different, compatible ranges of the same dependency. Faking that with "just follow the name, ignore the range" would have produced numbers that look precise but aren't honestly comparable to npm's. So I stopped at one hop for those two and said so, instead of pretending I'd done the same depth everywhere. -
npm's own dependency resolution de-duplicates by version, not just by name. My crawler
treats "foo" as one node the first time it sees it, regardless of which version a later
package wanted. A real
npm installcan end up with two different versions of the same package nested at different depths if the ranges don't overlap — so my counts are a floor on the real node_modules size, not an exact match to what you'd get on disk. -
I checked
latestonly. Your actualpackage.jsonmight be pinned behind several major versions where the dependency tree looked completely different. express 3.x, for instance, had a noticeably different dependency set than 5.x. "Current state" isn't "your state."
None of that changes the headline finding — lodash and chalk really do ship with nothing
attached right now, and the is-even chain really is down to three packages — but it's the
difference between "here's a fact about today's registry" and "here's a fact about your
project," and I don't want to blur those.
What's the most surprising zero-dependency (or dependency-bomb) package you've found sitting in
your own package.json, requirements.txt, or Cargo.toml — and did you find out by checking,
or by watching a build break?


Top comments (0)