---
title: How do I resolve a 'module not found' error?
description: Information on resolving a 'module not found' error.
url: /kb/guide/how-do-i-resolve-a-module-not-found-error
canonical_url: "https://vercel.com/kb/guide/how-do-i-resolve-a-module-not-found-error"
published: 2025-11-03
last_updated: 2026-08-03
authors: Sam Ko
related:
  - /docs/deployments/logs
  - /kb/guide/why-are-my-build-logs-loading-infinitely-and-not-showing-up
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

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.

## Why 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`.

## How to fix a 'module not found' error caused by casing

Start with your build logs, which show the exact path that failed to resolve:

1. Open your project's deployment in the Vercel dashboard and select **Build Logs**
   
2. Find the `Module not found: Can't resolve` line and note the import path it names
   
3. 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.

## How 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:

`git config core.ignorecase false`

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:

`git mv header.tsx header-tmp.tsx git mv header-tmp.tsx Header.tsx`

Commit both steps together, and Git records the casing change as an explicit rename that Vercel's case-sensitive build filesystem will match correctly.

## Other 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.json` and 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.

## Next steps

With the import path and filename casing matching, redeploy to confirm the build succeeds. [Create a new Vercel project](https://vercel.com/new), or [browse the templates](https://vercel.com/templates) if you're setting up a fresh one.

## Related resources

- [Accessing build logs](https://vercel.com/docs/deployments/logs)
  
- [Module Not Found (Next.js documentation)](https://nextjs.org/docs/messages/module-not-found)
  
- [Why are my Build Logs loading infinitely and not showing up?](https://vercel.com/kb/guide/why-are-my-build-logs-loading-infinitely-and-not-showing-up)
  

## Frequently asked questions

### Why 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.

### How 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.

### Does `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.

### Can 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.