It builds on your Mac but fails in CI, or it cannot find a module you can clearly see in the folder. 'Module not found' has a handful of distinct causes — let's rule them out one by one.
The Error
Module not found: Can't resolve '@/components/Button' (or './utils', or 'fs')
Cause 1: Path Alias Not Configured
If you use @/ imports, both TypeScript and the bundler must know what it maps to. Confirm your tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"paths": { "@/*": ["./*"] }
}
}Cause 2: Case-Sensitivity (Works Locally, Fails in CI)
macOS and Windows filesystems are case-insensitive; Linux (your CI/server) is not. import Button from "./button" resolves locally but fails on Linux if the file is Button.tsx. Make the import match the file's exact casing.
Cause 3: Dependency Not Installed
# Reinstall cleanly when node_modules is stale
rm -rf node_modules package-lock.json
npm installCause 4: Importing a Node Built-in on the Client
Trying to import fs, path, or crypto (Node modules) into client code fails because they do not exist in the browser. Move that logic into a Server Component, a Route Handler, or a server action.
Fast Triage
1) Does the path casing match exactly? 2) Is the alias in tsconfig? 3) Is it in package.json dependencies? 4) Is it a Node-only module used on the client? One of these four is always the answer.
