"Module not found: Can't resolve './components/header'" on Vercel or Netlify, but it builds on your computer
Module not found: Can't resolve './components/header'
Also appears as (2)
[UNRESOLVED_IMPORT] Could not resolve './components/header' in src/App.tsxerror TS2307: Cannot find module './components/header' or its corresponding type declarations.
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
- Fix ID
APP-13
Environment and versions
| os | Debian 13 (container) |
|---|---|
| node | 20.19.2 |
| vite | 8.3.5 (react-ts template) |
| git | 2.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.
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.tsxandheader.tsxas the same file by default. Vercel and Netlify build on Linux, where they are different files. - A sneakier version: you renamed
header.tsxtoHeader.tsxin Finder or Explorer. Git on a Mac or Windows usually doesn't notice a case-only rename, so GitHub still hasheader.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
$4The 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
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.