Module not found on Linux, fine on Mac
Last verified:
The fix
The Mac build resolves Button.tsx and button.tsx as the same file. Vercel, Netlify, and other Linux builders do not, so the import fails with module not found.
- 1
Compare the import to the path Git has stored
Open the import the build log names and run
git ls-fileson the file you think it is. Every character has to match, including capitals in each folder. Ifgit ls-filesdoes not list the file at all, the import is wrong or the file was never committed. That is the other module-not-found page. - 2
Record a case-only rename with git mv
Rename through a temporary name so Git stores the new case, then commit and push. A one-step
git mvof only the capital letters can fail on a case-insensitive disk withfatal: renaming ... failed: Invalid argumentordestination exists.git mv -fis enough for some files on current Git. Directories more often need the two-step rename. Do not add a second file that differs only by case.git mv components/Button.tsx components/button.tmp.tsx git mv components/button.tmp.tsx components/button.tsx git status - 3
Check core.ignorecase without flipping it globally
Run
git config --get core.ignorecasein the repo.trueis what Git set because the Mac disk ignores case, and it explains why a Finder rename never showed up ingit status. The fix Linux sees is thegit mvcommit, not this setting. The builder does not read it. Git's docs say changing it may result in unexpected behavior, so do not set--global. Settingcore.ignorecasetofalsein this repo only can makegit statusshow a case change. Leave ittrueif you are unsure. The pushed tree is what matters. - 4
Rebuild on the host
Push the commit and let Vercel or Netlify build again. The log should resolve the same path
git ls-filesprints. If it still cannot find the module, the import points at a file that is not in the commit, or a package that is not inpackage.json. Fix that path. Do not add an empty stub so the build goes green.
Why it happens
A default Mac disk (APFS) is case-insensitive, so an import of ./Button and a file stored as button.tsx are the same path in dev. The Linux image that builds the site treats them as two paths. The bundler then reports Module not found: Can't resolve for a file you can open locally.
Git on that Mac usually has core.ignoreCase set to true. git clone and git init probe the disk and set it when the filesystem ignores case. Git's config docs call it an internal variable: if a directory listing finds makefile when Git expects Makefile, Git assumes it is the same file and keeps the name it already stored. While it is true, a rename you make in Finder often never changes the path Git will send to Linux. The docs also say Git relies on the right setting for your operating system and that modifying the value may result in unexpected behavior.
The next error you'll probably hit
Once this is fixed, the usual follow-up is Module not found: Can't resolve. Module not found: Can't resolve means the import path or package is not on disk, often after an AI edit. Fix the path or install the package, then restart.
Prompt to paste back into your AI tool
Paste this above the error.
The Next.js or Vite build passes on my Mac and fails on Vercel or Netlify with Module not found: Can't resolve '<path>'. Do not create a second file that differs only by letter case. Do not set git config --global core.ignorecase. Do not add an empty module to silence the bundler. Do not change tsconfig unless the alias itself is wrong. 1. Compare the import string to `git ls-files` for that path. Quote both. 2. If only the capital letters differ, rename with git mv through a temporary name, then commit. A Finder rename is not enough when core.ignorecase is true. 3. You may show `git config --get core.ignorecase`. Explain that true is normal on a case-insensitive Mac disk. Do not change it globally. Git's docs say modifying it may result in unexpected behavior. 4. If the file is actually missing, say so and stop. Touch only the import and the filename case.
Common questions
+I renamed the file in the editor and git status is clean. Why does Linux still fail?
On a case-insensitive disk, Git with core.ignorecase true keeps the old capital letters in the index. git ls-files shows the name the builder will receive. Rename with git mv through a temporary name and commit that.
+Should I set core.ignorecase to false so this stops happening?
Git sets it true on purpose when the filesystem ignores case, and the config docs say changing it may result in unexpected behavior. Check it to understand a missing rename. Record the new case with git mv. Do not set the option globally.
Related errors
- Module not found: Can't resolveModule not found: Can't resolve means the import path or package is not on disk, often after an AI edit. Fix the path or install the package, then restart.CursorLovableBoltTypeScriptNext.jsOct 14, 2026
- Failed to resolve import "@/components/ui/button"Failed to resolve import "@/components/ui/button" from "src/App.tsx". Does the file exist? Vite never got the @ alias. TypeScript says Cannot find module '@/components/ui/button' or its corresponding type declarations.CursorLovableBoltTypeScriptViteNov 5, 2026
- Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x"The Vercel function is looking for the Linux query-engine binary and that file is not in the deployment. Generate ran for another OS, or the binary was stripped from the bundle.CursorBoltReplitPrismaVercelOct 23, 2026