Node.js
ERR_REQUIRE_ESM: require() of ES Module not supported
ERR_REQUIRE_ESM
You used require() to load a package that is ESM-only (has "type": "module" or .mjs).
Common Causes
- Package migrated to ESM
- Using CommonJS in ESM project
- Dynamic require of ESM package
Fixes
- 1. Use dynamic import
const mod = await import('esm-only-package'); - 2. Convert project to ESM
"type": "module" in package.json
- 3. Use createRequire
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
Still not fixed?
- • Search the exact error message on Stack Overflow or GitHub Issues
- • Check the official docs for the language or tool
- • Ensure your versions (Node, Python, npm, Docker) are up to date
- • Try in a minimal reproduction (new project, single file)
Related Errors
DuskTools That Might Help
All Errors
JavaScript Heap Out of MemoryModuleNotFoundErrorAddress Already in UseIndentationErrorCannot Find ModulePeer Dependency WarningCORS Policy BlockedTypeError: 'NoneType' Not SubscriptableMerge ConflictDocker Port Already AllocatedENOENT: No Such File or DirectoryKeyErrorMaxListenersExceededWarningRecursionErrorDetached HEAD StateEACCES: Permission DeniedValueErrorNo Space Left on DeviceFileNotFoundError