Skip to content

Module has no exported member 'X'

Error message

                Module has no exported member
              

Quick summary

You tried to import a name from a module, but the module doesn't export anything with that name. The import doesn't match any export.

Why this happens

  • Typo in the imported name

  • The export was renamed or removed

  • Importing a type that only exists in a .d.ts file that isn't found

  • Default vs named import mismatch

Minimal example

✗ Broken code
import { Usr } from "./types"; // typo: should be User
✓ Fixed code
import { User } from "./types";

Fix the typo: 'Usr' should be 'User'.

How to diagnose

  • Check the spelling of the imported name

  • Open the source module and verify the export exists

  • Check if it's a default export (use import X from not import { X } from)

  • Verify the module path is correct

How to fix

  • Fix the typo in the import name

  • Update the import to match the current export name

  • Use default import syntax for default exports

  • Add a re-export if the name exists in a sub-module

How to prevent

  • Use IDE auto-import features to avoid typos

  • Run ESLint with import/no-unresolved rule

  • Keep imports organized with auto-sort

Related Resources

Related Glossary

← Back to language