Cannot find module Discord.js helpp

Im attempting to make a discord bot that says random stuff, but when trying to activate it form cmd prompt with “node .”, this appears.

node:internal/modules/cjs/loader:922
throw err;
^

Error: Cannot find module ‘discord.js)’
Require stack:

  • D:\Archivos Pesados\data\Discord\Discord Bots\DrZoka\DrZoka.js
    ←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)←[39m
    ←[90m at Function.Module._load (node:internal/modules/cjs/loader:763:27)←[39m
    ←[90m at Module.require (node:internal/modules/cjs/loader:991:19)←[39m
    ←[90m at require (node:internal/modules/cjs/helpers:92:18)←[39m
    at Object. (D:\Archivos Pesados\data\Discord\Discord Bots\DrZoka\DrZoka.js:1:17)
    ←[90m at Module._compile (node:internal/modules/cjs/loader:1102:14)←[39m
    ←[90m at Object.Module._extensions…js (node:internal/modules/cjs/loader:1131:10)←[39m
    ←[90m at Module.load (node:internal/modules/cjs/loader:967:32)←[39m
    ←[90m at Function.Module._load (node:internal/modules/cjs/loader:807:14)←[39m
    ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)←[39m {
    code: ←[32m’MODULE_NOT_FOUND’←[39m,
    requireStack: [
    ←[32m’D:\Archivos Pesados\data\Discord\Discord Bots\DrZoka\DrZoka.js’←[39m
    ]
    }
1 Like

Geez, this seems to be happening a lot. Try these commands:

//1:
npm i discord.js
//2
enable-pnpm
//3
pnpm install discord.js

1 Like

I think I’ve done something bad, cause it doesn’t recognize any pnpm.

Any suggests?

And still the commands didn’t fix it :confused:

Can you try npm i pnpm first?
Actually, check your bot file. Are you writing
require("discord.js") or require("discord.js)"?

3 Likes

oh my god, thanks, I think both methods worked, but mostly with the (“discord.js)” script

2 Likes