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
- If it's a package name:
npm install <package>and check it's independencies, not just installed globally. - If it's a shadcn/ui component: add it with the shadcn CLI (
npx shadcn@latest add button). - If it's
@/...: make suretsconfig.jsonhas"paths": { "@/*": ["./src/*"] }(or./*, matching your folder) and, for Vite, a matchingresolve.alias. - 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
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.
Did this fix it?
(Placeholder: feedback isn't recorded yet.)