Vibe-Code Rescue

Module not found: Can't resolve './components/usercard'

Why it happens

The build works on your machine and fails on Vercel because of upper and lower case. Windows and macOS ignore case in file names. Vercel builds on Linux, where Header.tsx and header.tsx are two different files.

If you renamed a file by changing only its case, Git on those systems often does not record the change. Your import then points at a name the repository never got. A missing package or a wrong relative path gives the same message.

How to fix it

  1. Open the failed deployment in the Vercel dashboard, go to Build Logs, and find the line that starts with Module not found. Copy the exact path it names.
  2. Compare that path with the real file name as Git stores it, not with what your file explorer shows.
    git ls-files | grep -i usercard
  3. Make the import and the file name use the same case. If the file is components/UserCard.tsx, the import has to say ./components/UserCard.
  4. If Git shows no change after you renamed a file, tell it to notice case, then rename through a temporary name and commit both steps together.
    git config core.ignorecase false
    git mv header.tsx header-tmp.tsx
    git mv header-tmp.tsx Header.tsx
    git commit -m "Fix filename casing"
  5. If the path in the log is a package name instead of a file, make sure it is in package.json and committed. A package installed only on your machine never reaches the build.
    npm install package-name
  6. Push and let Vercel build again. To reproduce the failure before you push, build from a clean copy of the repository.
    git clone <your-repo-url> clean-copy
    cd clean-copy && npm ci && npm run build

When it is not this

Questions

Why does my import work locally but fail on Vercel?

Your computer probably ignores upper and lower case in file names. Vercel builds on a case-sensitive Linux filesystem, so an import with the wrong case points at a file that does not exist.

Does git config core.ignorecase false fix it on its own?

No. It only makes Git report case changes from now on. A rename Git already missed needs a two-step git mv through a temporary name.

Sources

Still broken?

The free health check asks ten questions about your app and shows the three fixes to do first. It runs in your browser.

If you would rather have someone read the code, the fixed-price audit is $497 one-time. It covers security and scaling, with a written report ranked by severity.