Module not found: Can't resolve '...'
Module not found: Can't resolve '@/components/ui/button'In one sentence: Your code imports a file or package that the build tool can't find.
What it means
Every `import` points to either an npm package or a file in your project. This error means the bundler looked where you told it and found nothing.
AI tools often generate imports for files they never created (like shadcn/ui components) or for packages they never installed.
Common causes
- The npm package isn't installed (it's missing from package.json).
- The file doesn't exist, or the path or file name is wrong.
- Letter case doesn't match: `Button.tsx` vs `button.tsx`. This works on Mac/Windows but fails on Linux servers like Vercel.
- The `@/` path alias isn't configured in tsconfig.json / jsconfig.json.
How to fix it
- If it's a package name (no ./ or @/): run `npm install <package>` and commit the updated package.json and lock file.
- If it's a file path: check that the file exists at exactly that path with exactly that capitalization.
- For `@/` imports, make sure tsconfig.json has `"baseUrl": "."` and `"paths": { "@/*": ["./*"] }` (or `./src/*` if you use a src folder).
- For shadcn/ui components, add the missing one with `npx shadcn@latest add button`.
Example
// tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": { "@/*": ["./src/*"] }
}
}Prompt to paste into your AI tool
The build fails with 'Module not found'. Check whether the import is a missing npm package, a missing file, a wrong path/capitalization, or a misconfigured @/ alias, and fix that root cause instead of rewriting the component.Still stuck?
Paste your exact error and code. Get a plain-English explanation free, or the full fix for $5.
Related errors
- TypeError: Cannot read properties of undefined
- CORS error: blocked by CORS policy
- Hydration failed: server HTML didn't match the client (Next.js)
- Supabase: new row violates row-level security policy
Weekly: the errors breaking vibe-coded apps and how to fix them. Free.
No spam. Unsubscribe anytime.