Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error [ERR_REQUIRE_ESM]: require() of ES Module #501

Open
Merlode11 opened this issue Jan 5, 2023 · 1 comment
Open

Error [ERR_REQUIRE_ESM]: require() of ES Module #501

Merlode11 opened this issue Jan 5, 2023 · 1 comment

Comments

@Merlode11
Copy link

Hello,
I installed the last version of discord-backup (v3.3.2) but when I start my bot, I got this error:

Instead change the require of C:\Users\Merlode\Documents\GitHub\ServerEditorBot\node_modules\node-fetch\src\index.js in C:\Users\Merlode\Documents\GitHub\ServerEditorBot\node_modules\discord-backup\lib\index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (C:\Users\Merlode\Documents\GitHub\ServerEditorBot\node_modules\discord-backup\lib\index.js:5:22)
    at Object.<anonymous> (C:\Users\Merlode\Documents\GitHub\ServerEditorBot\events\interactionCreate.js:2:16)
    at C:\Users\Merlode\Documents\GitHub\ServerEditorBot\index.js:56:23
    at Array.forEach (<anonymous>)
    at C:\Users\Merlode\Documents\GitHub\ServerEditorBot\index.js:55:11
    at FSReqCallback.oncomplete (node:fs:196:23) {
  code: 'ERR_REQUIRE_ESM'
}```

When I remove the `require("discord-backup")` declarations, the bot start well.

My Node version is `v16.17.0`

*The error is linked to `const node_fetch_1 = require("node-fetch");`*

How can I fix it ?
Thank you very much for the help !
@TheRealMangoAPI
Copy link

install [email protected]

@ghost ghost mentioned this issue Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants