BuildImports

Module not found: Can't resolve '...'

Module not found: Can't resolve '@/components/ui/button'

In short: An import points at a file or package that isn't there, or a path alias the build doesn't know.

Why it happens

AI-generated code references components it never created (common with shadcn/ui snippets from v0), packages it never installed, or the @/ alias without a matching paths entry in tsconfig.json / vite.config.

How to fix it

  1. If it's a package name: npm install <package> and check it's in dependencies, not just installed globally.
  2. If it's a shadcn/ui component: add it with the shadcn CLI (npx shadcn@latest add button).
  3. If it's @/...: make sure tsconfig.json has "paths": { "@/*": ["./src/*"] } (or ./*, matching your folder) and, for Vite, a matching resolve.alias.
  4. Check the exact filename and extension exist at that path, including letter case.
Don't: Don't let the AI 'fix' it by deleting the import and the feature that used it.

Copy-paste fix prompt

3 · The fix promptPaste into Cursor, Claude Code, Codex, Lovable, Bolt, Replit or v0
I'm getting this error in my app:

Module not found: Can't resolve '@/components/ui/button'

[Paste the full error, stack trace, and the file it points to here]

Likely cause: An import points at a file or package that isn't there, or a path alias the build doesn't know.

Task: For each unresolved import in the error, tell me whether it's a missing package, a missing file, or a broken path alias, and fix it with the smallest change (install, create, or configure).

Rules:
- First explain the root cause in 2 sentences and list the files you'll change.
- Make the smallest change that fixes it. Don't refactor unrelated code.
- Don't disable security or checks (RLS, auth, signature verification, type checking, CORS allow-all) to make the error disappear.
- Never print or hard-code secret keys.
- Finish by telling me exactly how to verify the fix.

Common with: v0, Cursor, Bolt, Lovable. Last reviewed 2026-11-13.

Related fixes

← All fixes · Still stuck? Use the diagnose-first prompt