Home / Guides / Self-Hosting & Infra
Fix Node.js "require is not defined", "Cannot use import statement" and ERR_REQUIRE_ESM
Resolving Node module-system errors: type field, .mjs and .cjs extensions, require versus import, dynamic import, __dirname and __filename in ESM, JSON imports, default export interop, ERR_REQUIRE_ESM, and TypeScript module settings.
Read the full guide
The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.
Open in the Knowledge Base Agent API →