You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
node_modules/esm/package.json: "version": "3.2.25"
node_modules/is-fn/package.json: "version": "3.0.0"
npm: 6.14.11
node: v12.22.0
/tmp/isfn3/node_modules/is-fn/index.js:1
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /tmp/isfn3/node_modules/is-fn/index.js
require() of ES modules is not supported.
require() of /tmp/isfn3/node_modules/is-fn/index.js from /tmp/isfn3/[eval] is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /tmp/isfn3/node_modules/is-fn/package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1015:13) {
code: 'ERR_REQUIRE_ESM'
}
Same if I make a file main.mjs and run that instead of -e, like in "Getting started" way 2.
The text was updated successfully, but these errors were encountered:
mk-pmb
changed the title
Node v12: Readme example fails with ERR_REQUIRE_ESM
Node v12: Readme example adapted to is-fn fails with ERR_REQUIRE_ESM
May 31, 2021
I almost managed to make a fallback to native dynamic import where it's available. However, that's Promise-based, so I won't be able to make it compatible with the sync-ness expected from a require(). How did you solve that time travel?
Hi! This is probably a dupe of #868 , but more boiled down, easier to replicate, because I'll include all code to reproduce.
If I understand the 3.2.25 readme correctly, this should work, right? On Ubuntu focal 64-bit, I make a new empty directory, then run in bash:
Unfortunately, it results in
Same if I make a file
main.mjs
and run that instead of-e
, like in "Getting started" way 2.The text was updated successfully, but these errors were encountered: