Error [ERR_REQUIRE_ESM]: require() of ES Module
See original GitHub issueVersions
- slice-machine-ui: 0.3.3
- @nuxtjs/prismic: "alpha",
Reproduction
Add both dependencies as devDependencies and run npm/yarn run slicemachine
, will yield the following error:
/node_modules/@slicemachine/core/build/src/utils/cliLogs.js:8
const ora_1 = __importDefault(require("ora"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/ora/index.js
from /node_modules/@slicemachine/core/build/src/utils/cliLogs.js not supported.
Instead change the require of index.js in /node_modules/@slicemachine/core/build/src/utils/cliLogs.js
to a dynamic import() which is available in all CommonJS modules.
Proposed solution
Use import
instead of require
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:7
Top Results From Across the Web
Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The node-fetch latest version doesn't use the require() syntax to import the package. You need to go to your package.json and type
Read more >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 >require() of ES Module fix-path/index.js from main.ts ... - GitHub
App threw an error during load Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/manuel/src/electron-react-boilerplate/node_modules/fix-path/index.js ...
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module - Support
Error [ERR_REQUIRE_ESM]: require() of ES Module when trying to compile a typescript service implementing the netlify api module. Version 11.0.1.
Read more >ERR_REQUIRE_ESM - DEV Community
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ~/projects/semantic-release-toolkit/node_modules/zz/cjs.js require() of ES ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Current dirty solution is to install
node-fetch
v2.6.1 -npm i node-fetch@2.6.1
I was having the same issue. The solution from @jeremytenjo to install v2.6.1 worked for me.
(Using a next.js project–so the error isn’t nuxt specific)