A local Docker build suddenly started failing with a MODULE_NOT_FOUND error, while the exact same build continued to pass in CI/CD.

Here’s how I tracked it down.

About the bug

Previously, I ran into a strange bug when building my Docker image locally:

node:internal/modules/cjs/loader:1424