Module does not provide an export named '...'
SyntaxError: The requested module './lib/utils.ts' does not provide an export named 'cn'
In short: A file imports a name that the module no longer exports, often after an AI rename or a default/named export mix-up.
Why it happens
AI edits frequently rename a function, switch export function cn to export default, or move a helper to another file and leave old imports behind. The bundler then throws does not provide an export named (Vite / native ESM) or Attempted import error (webpack / Next.js), and TypeScript reports has no exported member. This is not a missing package; the file exists, the name inside it does not.
How to fix it
- Open the module in the error and check what it actually exports (
export function,export const,export default, or a type-only export). - Fix the import to match:
{ cn }for a named export, no braces for a default export. Don't change both sides unless you mean to. - Search the repo for the old name. An AI edit often updates one file and misses the others.
- If the helper was deleted or moved, restore it or point the import at the new file. Check letter case in the filename too.
- Restart the dev server if a stale import cache still shows the old error.
Example
// lib/utils.ts
export function cn(...classes: string[]) {
return classes.filter(Boolean).join(" ");
}
// elsewhere: named import, matching the export
import { cn } from "@/lib/utils";
Copy-paste fix prompt
I'm getting this error in my app: SyntaxError: The requested module './lib/utils.ts' does not provide an export named 'cn' [Paste the full error, stack trace, and the file it points to here] Likely cause: A file imports a name that the module no longer exports, often after an AI rename or a default/named export mix-up. Task: For each 'is not exported' or 'does not provide an export named' error, compare the import with the file's actual exports and fix the mismatch (named vs default, renamed symbol, or moved file). Don't delete the feature to make the build pass. 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: Cursor, Claude Code, Codex, v0, Bolt, Lovable. Last reviewed 2026-11-15.