Im getting MODULE_NOT_FOUND while using discord.js

im trying to start writing discord bot on js, when i start it by “node .” it writes me MODULE_NOT_FOUND.
code:

const { Client, Intents } = require(‘discord.js’);

const js = require(‘discord.js’);

const prefix = ‘,’

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

const fs = require(‘fs’);

client.commands = new js.Collection();

const commandFiles = fs.readdirSync(‘./c/’).filter(file => file.endsWith(‘.js’));
for (const file of commandFiles){
const command = require(‘./c/${file}’);

client.commands.set(command.name, command);
}

client.once(‘ready’, () => {
console.log(‘Im Online!’)
});

client.on(‘message’, message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();

if (command === ‘ping’){
client.commands.get(‘ping’).execute(message, args);
} else if (command == ‘dev’){
client.commands.get(‘dev’).execute(message, args);
}
});

client.login(‘here are the token’);

Hi, maybe you need to use “npm install discourse.js”?

1 Like