i keep getting this error and i cannot find a solution

Error: Cannot find module 'discord.js'
Require stack:
- C:\Users\Yiğit\Desktop\marsh\index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (C:\Users\Yiğit\Desktop\marsh\index.js:1:47)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\Yiğit\\Desktop\\marsh\\index.js' ]
}
Error: Cannot find module 'discord.js'
Require stack:
- C:\Users\Yiğit\Desktop\marsh\index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (C:\Users\Yiğit\Desktop\marsh\index.js:1:47)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\Yiğit\\Desktop\\marsh\\index.js' ]
}
`
7 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Yido
YidoOP10mo ago
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.once(events.ClientReady, readyClient => {
console.log("${user.tag} is online!");
});

client.login(token);
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.once(events.ClientReady, readyClient => {
console.log("${user.tag} is online!");
});

client.login(token);
code ^^^
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Yido
YidoOP10mo ago
i did install it
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Yido
YidoOP10mo ago
No description
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server