question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module

See original GitHub issue

Hi! For all versions above 1.4.7, I’m getting the error below:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /xxxxxxxx/node_modules/@eo-locale/core/lib/index.js
require() of ES modules is not supported.
require() of /xxxxxxxx/node_modules/@eo-locale/core/lib/index.js from /xxxxxxx/node_modules/@eo-locale/react/lib/index..
Instead rename /xxxxxxx/node_modules/@eo-locale/core/lib/index.js to end in .cjs, change the requiring code to use import(), or remove "type: module"

In 1.4.8 the new exports and type properties were introduced in package.json for both @eo-locale/core and @eo-locale/react (possibly other packages as well - I didn’t check).

I’m not familiar with these properties but apparently, for node > 13 they will cause an exception when misconfigured, whereas in node < 13 they will merely emit a warning.

Downgrading to @eo-locale/react@1.4.7 solved the issue. I also had to add a resolution for the same version for @eo-locale/core since 1.4.11 will be auto-installed otherwise. The error above is emitted for both packages.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
westmarkcommented, Jan 12, 2021

Hi, sorry for the delay. This works fine now 👍

1reaction
pret-a-portercommented, Jan 4, 2021

@westmark I have reproduced the problem. I will try to fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The error [ERR_REQUIRE_ESM]: require() of ES Module not supported. Instead change the require of index.js to a dynamic import() which is available in...
Read more >
Must use import to load ES Module · Issue #28 · sindresorhus ...
In Node.js v14, I got this error. Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/salty/Documents/ ...
Read more >
Error [ERR_REQUIRE_ESM]: How to use es6 modules in ...
All you have to do is adding the flag --experimental-modules that supports the new es6 import/export statement also the order is important ...
Read more >
Error ERR REQUIRE ESM | Must use import to load ES Module
Error ERR REQUIRE ESM | Must use import to load ES Module. 15K views 1 year ago JS - JavaScript · Sagar S....
Read more >
Must use import to load ES Module - Netlify Support Forums
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /var/task/node_modules/@steeze-ui/heroicons/index.js require() of ES modules is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found