liveBook · Manning

Node_modules

node_modules is the conventional directory in a Node.js project where installed packages and their dependencies are stored.

How 3 Manning books explain it

Secrets of the JavaScript Ninja, Third Edition

The conventional directory in a Node.js project that contains installed JavaScript packages.

How it is used
Holds installed dependency trees and supports package-name imports in Node.js projects.
How deep it goes
Explains directory search, nested package versions, and entry-point precedence, while deferring the details of exports mappings.
Examples
Uses an Express install and import, plus a nested directory tree containing two lodash versions.
What you can do after
Diagnose/debug with it by tracing where a package-name import resolves and why different dependencies may load different versions.

Read how Secrets of the JavaScript Ninja, Third Edition explains node_modules →

Fast by Default

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

How it is used
Controls Node.js deployment size by exposing package duplication, oversized dependencies, and development-only contents.
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 you can do after
Diagnose with npm inspection tools, remove unnecessary dependencies, deduplicate versions, and produce leaner production installations.

Read how Fast by Default explains node_modules →

Road to Kubernetes

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

How it is used
Uses node_modules for local Node.js dependencies, excludes it from Git, and recreates it during container builds.
How deep it goes
Explains contents, deletion, recovery, tracking files, and container placement, but does not examine package internals.
Examples
Uses npm install, a Node.js .gitignore entry, and a Dockerfile that installs dependencies under /app.
What you can do after
Operate/configure Node.js dependencies by ignoring, deleting, restoring, and containerizing node_modules with npm.

Read how Road to Kubernetes explains node_modules →

Also covered in

What to know first

Related concepts

Questions about node_modules

What is node_modules?

node_modules is the conventional directory in a Node.js project where installed packages and their dependencies are stored.

Which Manning books explain node_modules?

Secrets of the JavaScript Ninja, Third Edition, Fast by Default and Road to Kubernetes.

What should I know before learning node_modules?

Manning books that teach node_modules usually introduce JavaScript and dependency first.

What are the parts of node_modules?

Node_modules includes package.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.