BlogBuild

Module not found: Can't resolve './components/Button' How to fix it.

The build cannot find something your code imports. The most common cause is a capital letter that does not match, because the build runs on Linux.

How the Agent API works
What you see
Module not found: Can't resolve './components/Button'

Vite: [UNRESOLVED_IMPORT] Could not resolve './components/Button'
Rollup failed to resolve import "./components/Button"
  • What it meansAn import points at nothing
  • Fix oneMatch the file name exactly
  • Fix twoAdd the package
  • Fix threeCommit the missing file

What it means

Your code imports a file or a package, and the build cannot find it. Webpack, Next.js and Create React App say "Module not found". Vite says "Could not resolve", or "Rollup failed to resolve import". They all mean the same thing.

How to fix it

  1. Check the capital letters

    If the import is ./components/Button and the file is button.tsx, it works on Windows and macOS and fails on Linux, because Linux treats Button and button as different files. Make the import and the file name match exactly.

  2. Check that the file was sent

    A file that is not committed, or is ignored by .gitignore, is not part of what was sent. Commit it.

  3. If it is a package, add it

    If the import is a package name, add it to dependencies in package.json, and commit the lock file.

Renaming a file that only changes capital letters

Git on Windows and macOS can miss a rename that only changes capital letters. Use git mv:

In a terminal
git mv src/components/button.tsx src/components/Button.tsx

01Questions

Import questions, answered.

Anything else? Write to us and a person answers.

support@antideploy.com
Why does it only fail online?

Your computer ignores capital letters in file names. The build server does not.

Is the path alias the problem?

It can be. An alias such as @/lib/db must be set in your tsconfig.json or your bundler's config. A missing alias gives the same message.

Does this failed deploy cost anything?

No. Failed deploys never count against your plan.

Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

Start from GitHub or a folder
Prompt copied Paste it into Claude Code, Codex or Cursor and press Enter.