A Module not found: Can't resolve error during a Vercel build almost always comes down to one thing: the casing in your import statement doesn't exactly match the casing of the actual filename. It builds locally because your machine's filesystem doesn't care about that mismatch, and it fails on Vercel because Vercel's build filesystem does.
Here's why that happens, how to find and fix the specific file causing it, and how to stop it from happening again.
Copy link to headingWhy does a 'module not found' error happen?
Windows and macOS use case-insensitive filesystems by default, so Header.tsx and header.tsx point to the same file on your machine. Vercel builds run on a case-sensitive Linux filesystem, where those are two different paths.
That difference only becomes a problem once Git gets involved. If you rename a file by changing only its casing, for example from header.tsx to Header.tsx, Git running on a case-insensitive system often doesn't register it as a change, because the filesystem itself reports the same path both times. The old casing stays in your commit history and on Vercel's build filesystem, even though your editor shows the new casing locally.
Your import statement still points to whichever casing you typed most recently, so the two drift apart. Vercel's build then looks for a file that, as far as Git is concerned, was never actually renamed, and the build fails with Module not found: Can't resolve.
Copy link to headingHow to fix a 'module not found' error caused by casing
Start with your build logs, which show the exact path that failed to resolve:
- Open your project's deployment in the Vercel dashboard and select Build Logs
- Find the
Module not found: Can't resolveline and note the import path it names - Compare that path, character by character, against the real filename in your repository (not your local file explorer, which may hide the mismatch)
If you're debugging with a teammate, click the timestamp next to the failing line to copy a link straight to it:
For example, if your component file is components/UserCard.tsx but a page imports it as ./components/usercard, the build fails with Module not found: Can't resolve './components/usercard', even though the file works fine locally. Fixing the import path or the filename so both use the same casing resolves it.
Once you've matched the casing in code, commit the change and redeploy. If the error persists after that, Git likely never picked up the rename in the first place, which the next section covers.
Copy link to headingHow to make Git track filename casing changes
If you already store the file under the casing you want but Git still shows no change, tell Git to stop ignoring case:
This setting alone only changes how Git reports differences going forward. It won't retroactively fix a rename Git already missed, and on a case-insensitive filesystem, a plain git mv oldname Oldname can still fail silently because the OS sees both names as the same path. Rename through a temporary name instead:
Commit both steps together, and Git records the casing change as an explicit rename that Vercel's case-sensitive build filesystem will match correctly.
Copy link to headingOther causes of module not found errors and how to fix them
Casing accounts for most cases, but two other causes produce the same error message:
- Missing dependency: If the unresolved path is a package name rather than a local file, confirm it's listed in
package.jsonand committed, since a package installed only locally never reaches Vercel's build. - Incorrect relative path: Count the
../segments against your file's actual folder depth. A path that resolves locally in an IDE with path aliases configured can still be wrong once Vercel builds from a clean checkout.
Working through casing first resolves most cases, and these two cover most of what's left.
Copy link to headingNext steps
With the import path and filename casing matching, redeploy to confirm the build succeeds. Create a new Vercel project, or browse the templates if you're setting up a fresh one.
Copy link to headingRelated resources
- Accessing build logs
- Module Not Found (Next.js documentation)
- Why are my Build Logs loading infinitely and not showing up?
Copy link to headingFrequently asked questions
Copy link to headingWhy does my import work locally but fail with 'module not found' on Vercel?
Your local machine likely uses a case-insensitive filesystem (Windows or macOS by default), so mismatched casing between a filename and its import still resolves. Vercel builds on a case-sensitive Linux filesystem, where Header.tsx and header.tsx are different paths, so the same import fails there.
Copy link to headingHow do I find which file is causing a 'module not found' error?
Open the failed deployment's Build Logs in the Vercel dashboard. The error line includes the exact import path the build couldn't resolve, for example Module not found: Can't resolve './components/usercard'. Compare that path, character by character, against your repository's actual filename to spot the casing mismatch causing the failure.
Copy link to headingDoes git config core.ignorecase false fix a casing mismatch on its own?
Not by itself. It makes Git report case-only changes going forward, but a rename Git already missed usually needs an explicit two-step git mv through a temporary filename to register correctly. Combine both so the corrected casing actually reaches Vercel's build filesystem.
Copy link to headingCan a missing dependency cause a 'module not found' error?
Yes. If the unresolved path is a package name instead of a local file, check that it's listed in package.json and committed to your repository. A package installed only on your machine, and never added to package.json, never reaches Vercel's build environment.