Skip to content

Vercel build errorVercel build fails with Module not found: Can’t resolve, but works locally

The app builds on your machine, then the Vercel build fails with Module not found: Can’t resolve and a path. Here’s how to find the file and fix it, in Vercel’s own words, or hand it over at a fixed price.

Short answer

Vercel says this error almost always means the casing in an import doesn’t exactly match the filename. Your Mac or Windows machine ignores the difference by default; Vercel’s Linux build doesn’t. Find the path in the Build Logs and make the import and the filename match exactly. If Git missed a case-only rename, rename through a temporary name with git mv. Otherwise check for a package missing from package.json or a wrong relative path.

Casing first, then the other two causes

  1. 01

    The import’s casing doesn’t match the filename

    “Vercel builds run on a case-sensitive Linux filesystem, where those are two different paths.” Vercel, Resolve a module not found error

    Windows and macOS treat Header.tsx and header.tsx as the same file by default. Vercel builds on a case-sensitive Linux filesystem, where they are two different paths, so an import that works locally fails there.

  2. 02

    Find the exact path in the Build Logs

    “Compare that path, character by character, against the real filename in your repository (not your local file explorer, which may hide the mismatch)” Vercel, Resolve a module not found error

    Open the deployment in the Vercel dashboard, select Build Logs and find the Module not found: Can’t resolve line. Check the path it names against the filename in your repository, not in your file explorer.

  3. 03

    Git never recorded a case-only rename

    “Commit both steps together, and Git records the casing change as an explicit rename that Vercel's case-sensitive build filesystem will match correctly.” Vercel, Resolve a module not found error

    If you renamed header.tsx to Header.tsx, Git on a case-insensitive system often doesn’t register a change, so Vercel still gets the old name. Set core.ignorecase to false, then rename through a temporary filename in two git mv steps and commit both together.

    git config core.ignorecase false
    git mv header.tsx header-tmp.tsx
    git mv header-tmp.tsx Header.tsx
  4. 04

    A package installed only on your machine

    “a package installed only locally never reaches Vercel's build.” Vercel, Resolve a module not found error

    If the path that won’t resolve is a package name rather than a local file, check that it’s listed in package.json and that the change is committed.

  5. 05

    A wrong relative path

    “A path that resolves locally in an IDE with path aliases configured can still be wrong once Vercel builds from a clean checkout.” Vercel, Resolve a module not found error

    Count the ../ segments against the file’s real folder depth. If the path only works in your editor because of path aliases, it can still fail on a clean checkout.

Checked against the vendor’s docs on : Vercel Knowledge Base: How do I resolve a module not found error?.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Bolt or Lovable build fails on deploy · Vercel environment variables undefined · Vercel function 504 timeout · Vercel 413 payload too large

Questions

More on this error

Why does the import work locally but fail on Vercel?

Windows and macOS use case-insensitive filesystems by default, so an import with the wrong casing still finds the file. Vercel builds on a case-sensitive Linux filesystem, so the same import fails there.

Is git config core.ignorecase false enough on its own?

Not by itself, Vercel says. It makes Git report case-only changes from now on, but a rename Git already missed usually needs the two-step git mv through a temporary filename.

What do you need to fix Module not found on Vercel?

Access to the repository and a link to the failed build. We find the import, fix the casing, the package or the path, and send it as a pull request you review and deploy.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; we reply by email, usually within one business day.