Please tell me how to fix error of running Discord bot

Discord bot running error.
"Error: Used disallowed intents "

Node version:

Running Error:

Started refreshing 0 application (/) commands.
(node:4556) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Successfully reloaded 0 application (/) commands.
          error: new Error("Used disallowed intents")

Error: Used disallowed intents
    at WebSocketShard.onClose (D:\TEMP\discord-bot\node_modules\@discordjs\ws\dist\index.js:1132:18)   
    at connection.onclose (D:\TEMP\discord-bot\node_modules\@discordjs\ws\dist\index.js:676:17)        
    at callListener (D:\TEMP\discord-bot\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onClose (D:\TEMP\discord-bot\node_modules\ws\lib\event-target.js:220:9)
    at WebSocket.emit (node:events:527:28)
    at WebSocket.emitClose (D:\TEMP\discord-bot\node_modules\ws\lib\websocket.js:260:10)
    at TLSSocket.socketOnClose (D:\TEMP\discord-bot\node_modules\ws\lib\websocket.js:1272:15)
    at TLSSocket.emit (node:events:539:35)
    at node:net:715:12
    at TCP.done (node:_tls_wrap:581:7)

Node.js v18.0.0

code snippet

  "name": "discord-bot",
  "type": "module",
  "main": "bot.js",
  "scripts": {
    "start": "nodemon bot.js"
  "dependencies": {
    "discord.js": "^14.14.1",
    "dotenv": "^16.4.1",
    "moment-timezone": "^0.5.44",
    "node-fetch": "^3.3.2",
    "nodemon": "^3.0.3"

As the error suggests, [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted, you’re probably using an intent that hasn’t been enabled.

Gateway Intents were introduced to the library in v12 and allow you to pick which events your bot will receive. Intents are groups of pre-defined events that the discord.js client will conditionally subscribe to. For example, omitting the DIRECT_MESSAGE_TYPING intent would prevent the discord.js client from receiving any typing events from direct messages.

You’ll have to go to Discord Developer Portal, choose your application, go to the Bot section, and enable all the intents. (Or the ones you are using.)

All credits: node.js - Discord.js Bot [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted Error - Stack Overflow