then-purpleT
Refine12mo ago
4 replies
then-purple

Issue with ERR_REQUIRE_ESM When Launching examples/base-material-ui

Hello,

I am encountering an error when trying to start the examples/base-material-ui project. The error message is as follows:

Error [ERR_REQUIRE_ESM]: require() of ES Module /**/refine/node_modules/wrap-ansi/node_modules/string-width/index.js from /**/refine/node_modules/wrap-ansi/index.js not supported.
Instead change the require of /**/refine/node_modules/wrap-ansi/node_modules/string-width/index.js in /**/refine/node_modules/wrap-ansi/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/**/refine/node_modules/wrap-ansi/index.js:2:21) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.18.2


It appears that the module wrap-ansi is attempting to use require() on an ES Module (string-width), which is causing the error.

Could anyone please advise on how to resolve this issue? Is there a recommended workaround or a configuration change that would allow the base-material-ui example to run correctly?

Thank you very much for your assistance!

Best regards,
iwasaki
Was this page helpful?