Hi There,

I am walking through the course JavaScript Discord Bot Tutorial – Code a Discord Bot And Host it for Free (Using the Youtube Video here) and I am following the code as closely as possible. I am not using Replit, because I want to deploy this on my own server after the course is complete so I want a more realistic experiance when working with this, so I am working in VS Code. I have however attempted to complete this in both VS Code and Replit and I get the same error.

I currently have the following

const Discord = require('discord.js')
const client = new Discord.Client()

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`)

client.on('message', (msg) => {
  if (msg.content === 'ping') {


Every time I attempt to run this code I am presented with the following error.

      throw new TypeError('CLIENT_MISSING_INTENTS');

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
    at Client._validateOptions (/home/arctic/Source/FreeCodeCamp/JavaScriptDiscordBot/node_modules/discord.js/src/client/Client.js:544:13)
    at new Client (/home/arctic/Source/FreeCodeCamp/JavaScriptDiscordBot/node_modules/discord.js/src/client/Client.js:73:10)
    at Object.<anonymous> (/home/arctic/Source/FreeCodeCamp/JavaScriptDiscordBot/index.js:2:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  [Symbol(code)]: 'CLIENT_MISSING_INTENTS'

I have jumped into the completed project source and checked to see if there were any changes to the main source of the projects and I am unable to find any differecne, I can also modify Beau’s code back down to what I have above and it runs flawlessly witout any change.

Any information that can br provided would be most appriciated.


Hi @ArcticStag !

Welcome to the forum!

I googled your error message and ran into a few stackoverflow answers.

You can these and see if any of them work

Thanks for this. I did see these on Stack Overflow, and kind of discounted them because the original source from the course works without the changes suggested on Stack overflow. You are however correct and after reading more thourougly I have chacked and confirmed that I am using the "discord.js": "^13.1.0" and the original source uses the "discord.js": "^12.5.1", which is the most likley cause of my stupidity.

Thank you for helping me see this!

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