Androz2091 / discord-backup

📦 Complete framework to facilitate server backup using discord.js v13
https://npmjs.com/package/discord-backup
MIT License
431 stars 81 forks source link

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

Open Merlode11 opened 1 year ago

Merlode11 commented 1 year ago

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 commented 1 year ago

install node-fetch@2.6.7