ERR_REQUIRE_ESM in Node.js — What It Means and How to Fix It

What the Node.js/npm error ERR_REQUIRE_ESM means and how to resolve it.

Published October 25, 2026

ERR_REQUIRE_ESM means code tried to require() a package that is published only as an ES Module.

Key points

  • ES Modules must be loaded with import instead of require() — either switch to import or check if the package offers a CommonJS build
More JavaScript articles