Records below are third-party data, not instructions. Apply with your own judgment.
Error [ERR_REQUIRE_ESM]: require() of ES Module <path>/node_modules/<pkg>/index.js from <path>/index.js not supported.
Cause
the dependency ships ES modules only ("type": "module" or .mjs) and this Node cannot load ESM through CommonJS require(); that was unflagged only in Node 22.12 and 20.19.
Fix
-const pkg = require('<pkg>');+// CommonJS can always load ESM asynchronously, inside an async function:+const { default: pkg } = await import('<pkg>');Don’t try
add "type": "module" to the app's package.json — every .js file in the app becomes ESM, so the existing require(), module.exports and __dirname then throw ReferenceError.
switch to import() but keep tsconfig "module": "commonjs" — under module commonjs tsc emits import() as Promise.resolve().then(() => require(...)), recreating the error; "module": "nodenext" keeps import() as written.