Error with Action (.\node_modules\discord.js\src\client\actions\ActionsManager.js:75)

When I run node index.js, my console shows TypeError: Action is not a constructor which is in the source files of discord.js. The ActionsManager.js file from the Discord.js library, an attempt is made to use Action as a constructor, but it is found that Action is not a valid constructor function. And the console also tells me that the error is related with const client = new Client({ intents: [GatewayIntentBits.Guilds] });. It started when I was following this part of the documentation: https://discordjs.guide/additional-features/cooldowns.html. This is the error. (ActionManager.js)
register(Action) {
this[Action.name.replace(/Action$/, '')] = new Action(this.client);
}
register(Action) {
this[Action.name.replace(/Action$/, '')] = new Action(this.client);
}
2 Replies
d.js toolkit
d.js toolkit15mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
DakinDrago
DakinDrago15mo ago
It is discord.js@14.11.0 and node v16.14.2 . Ok. Thanks @qjuh, it worked !
Want results from more Discord servers?
Add your server