"Module not found: Can't resolve './components/header'" on Vercel or Netlify, but it builds on your computer

Exact error
Module not found: Can't resolve './components/header'
Also appears as (2)
  • [UNRESOLVED_IMPORT] Could not resolve './components/header' in src/App.tsx
  • error TS2307: Cannot find module './components/header' or its corresponding type declarations.
Manually verified CI: pending

We reproduced the error and confirmed the fix on our own test machine on the date shown. Nightly CI re-runs are not running yet. How we verify.

Last verified
Re-test due
Published
Repro
17 files, hashes public
Fix ID
APP-13
Environment and versions
osDebian 13 (container)
node20.19.2
vite8.3.5 (react-ts template)
git2.47.3

In brief

Linux build servers are case-sensitive and your Mac or PC isn't. The full fix shows how to find the mismatch and the git-safe way to rename a file when git ignores case-only changes.

Get the full fix ↓

Symptom

You built the app on a Mac or Windows PC with Cursor, or exported it from Bolt or Lovable. npm run build works on your machine, but the Vercel or Netlify build fails with one of these:

Module not found: Can't resolve './components/header'                (Next.js / webpack)
[UNRESOLVED_IMPORT] Could not resolve './components/header' in src/App.tsx   (Vite)
error TS2307: Cannot find module './components/header' or its corresponding type declarations.

Why it happens

  • Upper and lower case. Macs and Windows treat Header.tsx and header.tsx as the same file by default. Vercel and Netlify build on Linux, where they are different files.
  • A sneakier version: you renamed header.tsx to Header.tsx in Finder or Explorer. Git on a Mac or Windows usually doesn't notice a case-only rename, so GitHub still has header.tsx.

What we could not test

  • A real Mac or Windows machine (the "builds locally" side and git's real core.ignorecase). Our attempt to fake it on Linux behaved differently and is marked not faithful in the repro.
  • Real Vercel or Netlify builds, and the exact Next.js/webpack wording.

The full fix

$4

The free part of this page tells you what's wrong. The full fix tells you exactly what to do. It includes:

  • Step-by-step fix, safest option first (the full page is 417 words)
  • 1 copy-paste block of commands, config or code
  • How to check it worked
  • Our test record from Oct 26, 2026: what we ran and what happened

Launching soon. Checkout isn't open yet; prices may change at launch. Join the waitlist. You can check what you'll get: SHA-256 of the full fix d481431a2afea25e… (how to check).

Sources

  1. Vercel KB: How do I resolve a 'module not found' error?
  2. Stack Overflow: Next.js build error on Vercel but not in local
  3. Vercel community: Module not found for existing file with correct casing
  4. next.js discussion 57507

How this page was made

Drafted by an AI agent and reproduced on our test machine on Oct 26, 2026. The scripts and logs are in the repro bundle; their file hashes are public on the repro page. Human review: not yet. No warranty: try fixes on a copy or staging environment first. Machine-readable versions: Markdown · JSON.

Found a mistake or a newer version where this breaks? Tell us.