GUIDES · BROKEN IMPORTS

Module not found on Vercel but it works locally: case sensitive imports

The import resolves on macOS and fails on Vercel with Module not found. Why Linux cares about casing, how to find the mismatch, and how to rename a file by case in git.

The error

Module not found: Can't resolve ./components/Header in /vercel/path0/app. The file exists in the repository as header.tsx. On macOS and Windows the default file systems ignore case, so the import works. Vercel builds on Linux, where Header.tsx and header.tsx are different files.

Find every mismatch

Clone the repository on Linux, or in a Docker container, and run the build. Or scan the repository with a tool that compares each relative import against the real file tree. The same class of bug hides in dynamic imports and in paths listed in next.config.

Rename a file by case in git

git mv Header.tsx header.tsx is a no op on a case insensitive disk. Rename through a temporary name so git records the change.

git mv components/header.tsx components/header-tmp.tsx
git mv components/header-tmp.tsx components/Header.tsx
git commit -m "Match import casing"

Prevent it

Set core.ignorecase to false in the repository, and add a lint rule or a CI job that builds on Linux before merging. Scanning the repository before every push catches it earlier than CI does.

Updated 2026-10-05