Cannot find module './structures/PrimaryEntryPointCommandInteraction'

Situation: I've tried to host a bot via Render which they throw err for Cannot find module './structures/PrimaryEntryPointCommandInteraction' Try on Local Code After I try on local code, I also got present with the same error:
node:internal/modules/cjs/loader:1228
throw err;
^

Error: Cannot find module './structures/PrimaryEntryPointCommandInteraction'
Require stack:
- D:\rcrpBot\src\index.js
at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Function._load (node:internal/modules/cjs/loader:1055:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
at Module.require (node:internal/modules/cjs/loader:1311:12)
at require (node:internal/modules/helpers:136:16)
at Object.<anonymous> (D:\rcrpBot\src\index.js:3:45)
at Module._compile (node:internal/modules/cjs/loader:1554:14)
at Object..js (node:internal/modules/cjs/loader:1706:10)
at Module.load (node:internal/modules/cjs/loader:1289:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'D:\\rcrpBot\\src\\index.js' ]
}

Node.js v22.14.0
[nodemon] app crashed - waiting for file changes before starting...
node:internal/modules/cjs/loader:1228
throw err;
^

Error: Cannot find module './structures/PrimaryEntryPointCommandInteraction'
Require stack:
- D:\rcrpBot\src\index.js
at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Function._load (node:internal/modules/cjs/loader:1055:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
at Module.require (node:internal/modules/cjs/loader:1311:12)
at require (node:internal/modules/helpers:136:16)
at Object.<anonymous> (D:\rcrpBot\src\index.js:3:45)
at Module._compile (node:internal/modules/cjs/loader:1554:14)
at Object..js (node:internal/modules/cjs/loader:1706:10)
at Module.load (node:internal/modules/cjs/loader:1289:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'D:\\rcrpBot\\src\\index.js' ]
}

Node.js v22.14.0
[nodemon] app crashed - waiting for file changes before starting...
What could be causing this?
7 Replies
d.js toolkit
d.js toolkit•5mo 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!
bug
bugOP•5mo ago
discord.js version - discord.js@14.21.0 node version - v22.14.0
treble/luna
treble/luna•5mo ago
Show your code
bug
bugOP•5mo ago
main index.js? If yes here:
require("dotenv").config();
const { Client, IntentsBitField } = require("discord.js");
const mongoose = require("mongoose");
const eventHandler = require("./handler/eventHandler");
const client = new Client({
intents: new IntentsBitField([
"Guilds",
"GuildMembers", // Required for fetching guilds
"GuildMessages", // Required for fetching channels
"GuildMessageReactions",
"MessageContent",
"GuildBans",
"GuildEmojisAndStickers",
"GuildIntegrations",
"GuildWebhooks",
"GuildInvites",
"GuildVoiceStates",
"GuildPresences",
"DirectMessages",
"DirectMessageReactions",
"DirectMessageTyping",
]),
});

mongoose.connect(process.env.MONGODB_URI).then(async () => {
console.log("📅 Connected to MongoDB");
eventHandler(client);

client.login(process.env.TOKEN);
});
require("dotenv").config();
const { Client, IntentsBitField } = require("discord.js");
const mongoose = require("mongoose");
const eventHandler = require("./handler/eventHandler");
const client = new Client({
intents: new IntentsBitField([
"Guilds",
"GuildMembers", // Required for fetching guilds
"GuildMessages", // Required for fetching channels
"GuildMessageReactions",
"MessageContent",
"GuildBans",
"GuildEmojisAndStickers",
"GuildIntegrations",
"GuildWebhooks",
"GuildInvites",
"GuildVoiceStates",
"GuildPresences",
"DirectMessages",
"DirectMessageReactions",
"DirectMessageTyping",
]),
});

mongoose.connect(process.env.MONGODB_URI).then(async () => {
console.log("📅 Connected to MongoDB");
eventHandler(client);

client.login(process.env.TOKEN);
});
treble/luna
treble/luna•5mo ago
first of all, those comments are incorrect. Guilds is needed to cache guilds and channels, and dont require fetching when you have it. Not GuildMembers. Second, have you tried a clean reinstall of djs
bug
bugOP•5mo ago
Yeah. I tried uninstall then install. .
NyR
NyR•5mo ago
Most likely a curropt installation. Try nuking your node_modules (preferably also package_lock.json) and then run npm i again

Did you find this page helpful?