EthioDeploy
DocsPricingDomainsBlogToolsChangelog

Blog/Fix deploy errors

"Module not found" after deploy: case-sensitive imports on Linux

BS
Brook SolomonPublished November 29, 2026
Share on XShare on LinkedIn
./Button

THE SHORT ANSWER

If the build works on your Mac or Windows machine and fails on the server with "Module not found: Can't resolve './components/button'", Vite's "Could not resolve", or Node's ERR_MODULE_NOT_FOUND, check letter case first. macOS and Windows disks ignore case by default, so ./button finds Button.tsx locally; Linux servers don't. Either the import's case is wrong, or you renamed the file by changing only its case and Git still has the old name, because Git on those systems ignores case-only renames. Run git ls-files | grep -i button to see the name the server gets, fix the import or rename with git mv (two steps for a folder), commit, and redeploy.

What does the error look like?

The project has components/Button.jsx, and a page imports ../components/button. On a Linux build machine, each tool reports it in its own words:

# Next.js 16 (Turbopack and webpack)
./app/page.jsx
Module not found: Can't resolve '../components/button'

# Vite 7
Could not resolve "./components/button" from "src/main.js"

# Node.js, ES modules
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/src/utils/helper.js' imported from /app/src/index.js

# Node.js, require()
Error: Cannot find module './utils/helper.cjs'

All four come from the same place: the file system was asked for button and only has Button. On macOS and Windows, which ignore case by default, the same lookup succeeds. We ran the Vite build and the Node script above on a Mac disk and both worked, then ran them on a Linux disk and got these errors. That's why the bug survives every local test and appears on the first deploy.

The error names the import that failed. If the path is a package name rather than a file (Can't resolve 'dotenv'), case is rarely the problem; check that the package is in package.json. For Python's version of this, see ModuleNotFoundError after deploy.

Which of the two causes is it?

There are two ways to end up here, and they need different fixes:

  1. The import is wrong. The file is Button.tsx in Git and on your disk, and some import says ./button. Fix the import.
  2. Git has the old name. You renamed button.tsx to Button.tsx in your editor or Finder. Your imports match the new name, but Git never recorded the rename, so the server gets button.tsx. Fix the name in Git.

Ask Git which name it has. Whatever git ls-files prints is exactly what the server clones:

git ls-files | grep -i button
# components/button.tsx   <- the server has this

ls components
# Button.tsx              <- your disk shows this

If the two disagree, it's cause 2. If they agree, search the code for the import with the wrong case (grep -rn "components/button" src).

Why doesn't Git see a case-only rename?

When you create or clone a repo on a case-insensitive disk, Git sets core.ignoreCase to true. Git then treats button.tsx and Button.tsx as the same file. Rename one to the other outside Git and git status shows nothing to commit. We checked with Git 2.50 on macOS: after a plain mv, the working tree looked clean.

Rename through Git instead. For a file, one step works:

git mv components/button.tsx components/Button.tsx
git status
# renamed: components/button.tsx -> components/Button.tsx
git commit -m "Rename button.tsx to Button.tsx"

A folder fails in one step on macOS:

git mv Components components
# fatal: renaming 'Components' failed: Invalid argument

Go through a temporary name:

git mv Components components-tmp
git mv components-tmp components
git commit -m "Rename Components/ to components/"

Don't fix it by setting core.ignoreCase false on a Mac. The disk still can't hold two names, so Git starts tracking both button.tsx and Button.tsx, and the Linux checkout gets two files. If that already happened, this lists the duplicates:

git ls-files | sort -f | uniq -di

Remove the wrong one from the index with git rm --cached path/to/button.tsx and commit.

How do you catch it before deploying?

A few checks that fail on your machine instead of on the server:

  • TypeScript reports it when the file is also part of the project through include, which is the usual setup. forceConsistentCasingInFileNames is on unless you turn it off. In our test, TypeScript 5.9 on macOS printed:
    error TS1149: File name '/app/components/button.ts' differs from already included file name '/app/components/Button.ts' only in casing.
    Run npx tsc --noEmit before you push.
  • ESLint with eslint-plugin-import: the import/no-unresolved rule reports imports whose case doesn't match the file on a case-insensitive disk, through its caseSensitive option, which defaults to on.
  • Build on Linux once. Copy the project into a container rather than mounting it. A bind mount from a Mac keeps the Mac's case-insensitive behavior, and the build passes when it shouldn't:
    docker run --rm -v "$PWD":/src:ro node:22 \
      sh -c 'cp -r /src /app && cd /app && rm -rf node_modules && npm ci && npm run build'
  • Pick one naming rule for files, such as PascalCase for components and kebab-case for everything else, so the right case is easy to guess.

What happens on EthioDeploy?

Builds run on Linux servers, so a case mismatch fails the build with one of the errors above, in the build log. Nothing is deployed and the previous version keeps serving. Fix the import or the name in Git, push, and the new commit deploys.

If the error names import.meta.env or a variable rather than a file, it's a different problem: see Vite env variables undefined in production. Setup for each framework is in the Next.js and Node.js deploy guides.

Questions

Most often an import's letter case doesn't match the file name. macOS and Windows ignore case by default, so ./button finds Button.tsx there, while the Linux build machine doesn't. Fix the import or the file name, and make sure Git has the new name.

Use git mv old new, for example git mv button.tsx Button.tsx, then commit. A plain rename in your editor isn't recorded on macOS or Windows because core.ignoreCase is true. For a folder, rename through a temporary name in two git mv steps.

Run git ls-files | grep -i name. That prints the path as stored in the repository, which is what the server checks out, even when your disk shows a different case.

Not on a case-insensitive disk. Git can then track two files that differ only in case while your disk holds one of them, and the Linux checkout gets both. Use git mv for case-only renames instead.

Yes, when the file is also included in the project, which is the default with include globs. TypeScript reports TS1149, "differs from already included file name only in casing", unless forceConsistentCasingInFileNames is set to false.

Sources

Checked on November 29, 2026:

  • Git: git-config (core.ignoreCase)
  • Git: git-mv
  • TypeScript: forceConsistentCasingInFileNames
  • eslint-plugin-import: no-unresolved
  • Next.js: Module not found
  • Node.js: ES modules resolution

Push a repo. Get a URL.

  • Deploy a Next.js app
  • Deploy a Node.js app
  • Vite env variables undefined in production
  • ModuleNotFoundError after deploy
Start free

Join the EthioDeploy Telegram

Release notes as they ship, plus deploy help from the team and other developers.

Join on Telegram
BS
WRITTEN BYBrook SolomonFounder, EthioDeploy

Brook Solomon founded EthioDeploy and builds its deploy pipeline, build servers and AI coding agent. The posts here come from errors seen in real deploys on the platform.

All posts by Brook →
On this page
  • What does the error look like?
  • Which of the two causes is it?
  • Why doesn't Git see a case-only rename?
  • How do you catch it before deploying?
  • What happens on EthioDeploy?
  • Questions
  • Sources
0% read

Keep reading

  • Mixed Content: blocked

    Fix deploy errorsNov 29, 2026

    Mixed content blocked after moving to HTTPS: causes and fixes

    A mixed content error means the page loaded over HTTPS but asked for something over plain http://. Browsers block scripts, stylesheets, fetch() and XMLHttpRequest calls (Chrome: "This request has been blocked; the content must be served over HTTPS") and upgrade images, audio and video to https on their own. After a deploy the cause is usually one of three things: an http:// URL in your code or in an env var such as the API base URL, a backend behind a TLS-terminating proxy that thinks it runs on http and builds http:// links, or old http:// URLs saved in the database. Change the URLs to https:// or relative paths, make the framework trust X-Forwarded-Proto, and treat the upgrade-insecure-requests CSP directive as a stopgap.

  • Health check failed

    Fix deploy errorsNov 29, 2026

    Health check failed: app not listening on its port

    A deploy fails its health check when the platform starts the new version and gets no healthy answer in time. There are four reasons: nothing listens on the port the platform probes, the process exits, the app takes longer to start than the platform waits, or it answers the check path with an error status such as 404. Render logs "No open ports detected" and fails the deploy, Railway marks the deploy failed when the healthcheck path returns no 2xx within 300 seconds, Fly warns "The app is not listening on the expected address", and Heroku kills a web process that hasn't bound to $PORT within 60 seconds (R10). Read the log to see which of the four it is: then listen on 0.0.0.0 and $PORT, move slow work out of startup, or point the health check at a route that returns 200.

  • .python-version

    Fix deploy errorsNov 29, 2026

    Python version mismatch on deploy: SyntaxError, "requires a different Python" and failed wheels

    If your app works locally and the deploy fails with a SyntaxError on valid code, "Ignored the following versions that require a different python version", or a wheel that won't build, the server is running a different Python than you are. Check with python --version locally and in the build log, then pin the same minor version in a .python-version file containing just 3.12 (or whatever you use). Heroku, Render, uv and pyenv all read that file; runtime.txt is deprecated on Heroku. Nixpacks, which EthioDeploy uses, reads NIXPACKS_PYTHON_VERSION, .python-version and runtime.txt, knows only 3.7 to 3.13, and silently falls back to 3.12 for anything else. requires-python in pyproject.toml doesn't choose the interpreter on any of them except uv. With a Dockerfile, the FROM line decides.

EthioDeploy

Agentic first development and deployment, started in Ethiopia, built for developers everywhere.

Telegram community
Product
PricingAI coding agentAgent mode docsDomainsCLIFree backend hostingHosting in EthiopiaChangelog
Deploy guides
Next.jsNode.jsPythonSvelteKitTanStack StartAstroNuxtReact RouterHonoStrapiPayload CMSDjangoDjango + CeleryFastAPIFlaskStreamlitExpressNestJSSocket.IOLaravelRailsGoSpring BootASP.NET CoreTelegram botDiscord botWhatsApp botn8nLovableBoltReplitv0Google AI StudioBase44Firebase StudioClaude Code & Cursor
Compare
vs Herokuvs Vercelvs Rendervs Railwayvs Fly.iovs Netlifyvs KoyebHeroku alternativesVercel alternativesNetlify alternativesRender alternativesRailway alternativesFly.io alternativesReplit alternativesPythonAnywhere alternativesDigitalOcean App Platform alternativesGlitch alternatives
Resources
DocsBlogFree toolsAboutSupportContactllms.txt
© 2026 EthioDeployPay by card in USD or bank transfer in ETBTermsPrivacy