liveBook · Manning

Node_modules

As explained in Fast by Default

The node_modules directory is the filesystem directory containing installed Node.js packages and their transitive dependencies.

node_modules is the filesystem directory where a Node.js backend service ships installed packages and their transitive dependencies. Its size can materially inflate production images, so measure the directory rather than treating dependencies as an invisible build detail. section 8.2.2

Use the dependency tree and size reports to find recurring sources of excess:

  • Inspect the full tree; thousands of packages can indicate duplicate versions. section 8.2.2
  • Flatten compatible duplicates with npm dedupe to let packages share common dependencies. section 8.2.2
  • Exclude development dependencies from production with npm ci --omit=dev. section 8.2.2

How Fast by Default covers it

How deep it goes
Explains directory measurement, dependency-tree inspection, deduplication, package-size auditing, and production exclusion, but not package internals.
Examples
Uses npm ls --all, disk-usage ranking, npm-size, and cost-of-modules to inspect dependency structure and installed size.
What it assumes
Assumes a Node.js service and npm workflow; teaches directory measurement and production dependency exclusion.
What you can do after
Diagnose with npm inspection tools, remove unnecessary dependencies, deduplicate versions, and produce leaner production installations.
How it connects
Connects node_modules with npm dependencies, transitive dependencies, npm deduplication, and container images.

Also explained in

Compare how 3 books explain node_modules →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast by Default. The section links point to the parts of the book it draws on.