Help for the tutorial for coding a discord bot using javascript

I recently watched @beaucarnes tutorial about coding a discord bot using javascript. When I run the bot after adding the “$inspire” feature the build fails giving me this error -

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/runner/Botjs/node_modules/node-fetch/src/index.js
require() of ES modules is not supported.
require() of /home/runner/Botjs/node_modules/node-fetch/src/index.js from /home/runner/Botjs/index.js 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 /home/runner/Botjs/node_modules/node-fetch/src/index.js to end in .cjs, change the requiring code to use import(), or remove “type”: “module” from /home/runner/Botjs/node_modules/node-fetch/package.json.
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1015:13)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at /home/runner/Botjs/index.js:2:15
at Script.runInContext (vm.js:130:18)
at Object. (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)Hint: hit control+c anytime to enter REPL.

I think you need to install the previous discord.js version, the new version of discord.js needs a successive version of nodejs than what replit uses

Note that it’s best to include a link to your project when you ask for help

see here on how to install previous discordjs version:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.