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

URL: https://antideploy.com/blog/module-not-found-cant-resolve

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.

**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"
```

## At a glance

- **What it means**: An import points at nothing
- **Fix one**: Match the file name exactly
- **Fix two**: Add the package
- **Fix three**: Commit the missing file

Published 7 October 2026. Facts checked 7 October 2026. 1 min read.

## 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
```

## Import questions, answered.

Anything else? Write to us and a person answers.

[support@antideploy.com](mailto: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.

## More guides, and the platform.

Each platform page covers one part of Antideploy: what it does, where it stops and the questions people ask. [See the whole platform](https://antideploy.com/platform), or [all the guides](https://antideploy.com/blog).

- [TypeScript error fails the build](https://antideploy.com/blog/typescript-error-fails-the-build): A type error stops the build even when the app runs locally in dev mode. Run the type check and fix it.
- [npm ci can only install packages when your package.json and package-lock.json are in sync](https://antideploy.com/blog/npm-ci-can-only-install-packages-when-package-json-and-package-lock-json-are-in-sync): The lock file does not match package.json. Run npm install and commit the lock file.
- [How to deploy a Vite React app](https://antideploy.com/blog/how-to-deploy-a-vite-react-app): A Vite app deploys as a free static site. The build, the dist folder, routing and variables.

- [Deployments](https://antideploy.com/platform/deployments)
- [Logs and monitoring](https://antideploy.com/platform/logs-and-monitoring)

Facts on this page were checked against the live platform on 7 October 2026.

## 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.

To set this up, give your coding agent this sentence:

```text
Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.
```
