Skip to content
>_VibeUnstuck

The requested module does not provide an export named

Last verified:

The fix

The file loaded, and the name you imported is not one of its exports. Vite reports a SyntaxError in the browser. Next.js says the name is not exported, or that the export does not exist in the target module.

  1. 1

    Read the export name and open that file

    Copy the name after export named or is not exported. Open the module path from the same line. At the bottom of the file, see whether the symbol is export default or export function / export const. Do not create a second component with the missing name.

  2. 2

    Make the import match the export

    Braces mean named. No braces means default. Change the import, not both sides, unless the file was supposed to have that name and the model simply never exported it. If the file only has a default and you want a named import at the call site, re-export it once.

    import Button from "./Button";
    import { Button } from "./Button";
    
    export { default as Button } from "./Button";
  3. 3

    Fix the barrel, then restart Vite

    export { Button } from './Button' fails when Button.tsx only has export default. Use export { default as Button } from './Button'. If the browser URL contains node_modules/.vite/deps and the source export is already correct, stop the dev server, delete node_modules/.vite, and start it again. That folder is Vite's dependency cache. Do not edit files inside it.

  4. 4

    Leave a node_modules export alone

    If the module path is inside node_modules and the overlay says the module has no exports at all, you imported a name the package does not publish, or a server-only file was pulled into client code. Import the name from the package's documented entry. Do not add a webpack alias to hide it, and do not patch the package file. A missing file is the module-not-found page.

Why it happens

The browser's native module error is Uncaught SyntaxError: The requested module './Button' does not provide an export named 'Button'. Vite serves your source as ES modules, so a bad named import fails in the browser console and the terminal can stay quiet. The name in quotes is the export the import asked for. The module path is the file that did load. This is not "module not found." That error means the file itself never resolved.

Next.js prints the same mismatch in bundler words. Webpack's overlay says Attempted import error: 'Button' is not exported from './Button'. Turbopack says Export Button doesn't exist in target module and, when it can, The export Button was not found in module. TypeScript's version, before the page loads, is Module '"./Button"' has no exported member 'Button'.

Generated code mixes the two export styles. export default function Button is a default export, and import { Button } asks for a named one. export function Button is named, and import Button from './Button' asks for a default. A barrel file that re-exports the wrong kind fails the same way. A second, less common case is a dependency: the message points at node_modules and says the module has no exports at all. That is a package interop or a server-only file pulled into the client, not a component you should rewrite.

The next error you'll probably hit

Once this is fixed, the usual follow-up is Module not found: Can't resolve. Module not found: Can't resolve means the import path or package is not on disk, often after an AI edit. Fix the path or install the package, then restart.

Prompt to paste back into your AI tool

Paste this above the error.

The error is: The requested module '<path>' does not provide an export named '<Name>'. On Next.js it may instead say Attempted import error: '<Name>' is not exported from '<path>', or Export <Name> doesn't exist in target module.

Do not create a new file with that name. Do not add export default and a named export and export * to the same file to cover every import. Do not edit node_modules. Do not change tsconfig paths for this.

1. Open the module in the error and quote its export line (export default, or export function / export const).
2. Change the import to match: braces for a named export, no braces for default. If a barrel re-exports it, use export { default as Name } only when the file has a default.
3. If the path is under node_modules/.vite and the source export is already correct, tell me to delete node_modules/.vite and restart. If the path is a package and the message says the module has no exports, say which entry point actually exports this name. Do not alias it.
4. Touch only the import and, if the export is missing on purpose, that one export line.

Common questions

+The terminal is clean and the browser says the module does not provide an export. Where is the bug?

Vite handed the file to the browser as an ES module. The SyntaxError is in the browser console, and it names the export and the file. The dev server does not always reprint that line.

+TypeScript says has no exported member, but the page has not loaded. Same mistake?

Yes. That diagnostic is the type checker noticing the import name is absent. Fix the import or the export. Waiting for the browser to throw the SyntaxError does not add information.

+Could this be a missing file?

No. A missing file is Module not found: Can't resolve, or Cannot find module. This error means the module loaded and the name you asked for is not in its export list. Wrong filename case is the missing-file page too.

Related errors