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


