SyntaxError: The requested module '@discordjs/util' does not provide an export named 'calculateShard

I am unsure where to go for help, so I'm putting it here. I have no idea where this error is coming from. I looked into ws and rest, and I can't find anything that points me to right direction
import { Client, GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags } from '@discordjs/core';
import { REST } from '@discordjs/rest';
import { WebSocketManager } from '@discordjs/ws';
import { DurationFormatter } from '@sapphire/duration';
import { RateLimitManager } from '@sapphire/ratelimits';
import { Time } from '@sapphire/timestamp';
import { token } from './config.js';

const rest = new REST({ version: '10' }).setToken(token);
const ws = new WebSocketManager({
token,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

const client = new Client({ rest, ws });

const formatter = new DurationFormatter();
const rateLimitManager = new RateLimitManager(Time.Day, 50);
const ratelimit = rateLimitManager.acquire('global');

client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {
console.log(interaction);
if (interaction.type !== InteractionType.ApplicationCommand || interaction.data.name !== 'ask') return;
if (ratelimit.limited) {
await api.interactions.reply(interaction.id, interaction.token, {
content: `The command is on a cooldown.\nYou'll be able to use the commands again in ${formatter.format(
ratelimit.remainingTime,
)}`,
});
return;
}

await api.interactions.reply(interaction.id, interaction.token, { content: 'Pong!', flags: MessageFlags.Ephemeral });
ratelimit.consume();
});
import { Client, GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags } from '@discordjs/core';
import { REST } from '@discordjs/rest';
import { WebSocketManager } from '@discordjs/ws';
import { DurationFormatter } from '@sapphire/duration';
import { RateLimitManager } from '@sapphire/ratelimits';
import { Time } from '@sapphire/timestamp';
import { token } from './config.js';

const rest = new REST({ version: '10' }).setToken(token);
const ws = new WebSocketManager({
token,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

const client = new Client({ rest, ws });

const formatter = new DurationFormatter();
const rateLimitManager = new RateLimitManager(Time.Day, 50);
const ratelimit = rateLimitManager.acquire('global');

client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {
console.log(interaction);
if (interaction.type !== InteractionType.ApplicationCommand || interaction.data.name !== 'ask') return;
if (ratelimit.limited) {
await api.interactions.reply(interaction.id, interaction.token, {
content: `The command is on a cooldown.\nYou'll be able to use the commands again in ${formatter.format(
ratelimit.remainingTime,
)}`,
});
return;
}

await api.interactions.reply(interaction.id, interaction.token, { content: 'Pong!', flags: MessageFlags.Ephemeral });
ratelimit.consume();
});
https://juan.evaded.tax/i/9qdgu.png
Solution:
"resolutions": {
"@discordjs/util": "0.1.1-dev.1675598630-405f940.0"
},
"resolutions": {
"@discordjs/util": "0.1.1-dev.1675598630-405f940.0"
},
...
Jump to solution
6 Replies
Juan Pablo
Juan Pablo17mo ago
I have a strong feeling that's a case of dependency clash
24
2417mo ago
note- why not use sapphire if you're this far?
Juan Pablo
Juan Pablo17mo ago
because I don't need it, and I also want to learn the lower level libraries my reproducible code
import { Client, GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags } from '@discordjs/core'; // 0.3.1-dev.1675512288-8b70f49.0
import { REST } from '@discordjs/rest'; // 1.5.0
import { WebSocketManager } from '@discordjs/ws'; // 0.6.0

const token = '';

const rest = new REST({ version: '10' }).setToken(token);
const ws = new WebSocketManager({
token,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

const client = new Client({ rest, ws });

client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {
console.log(interaction);
if (interaction.type !== InteractionType.ApplicationCommand || interaction.data.name !== 'ask') return;

await api.interactions.reply(interaction.id, interaction.token, { content: 'Pong!', flags: MessageFlags.Ephemeral });
});
import { Client, GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags } from '@discordjs/core'; // 0.3.1-dev.1675512288-8b70f49.0
import { REST } from '@discordjs/rest'; // 1.5.0
import { WebSocketManager } from '@discordjs/ws'; // 0.6.0

const token = '';

const rest = new REST({ version: '10' }).setToken(token);
const ws = new WebSocketManager({
token,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

const client = new Client({ rest, ws });

client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {
console.log(interaction);
if (interaction.type !== InteractionType.ApplicationCommand || interaction.data.name !== 'ask') return;

await api.interactions.reply(interaction.id, interaction.token, { content: 'Pong!', flags: MessageFlags.Ephemeral });
});
Favna
Favna17mo ago
you say you're not sure where to go but have you considered discord.gg/djs
Juan Pablo
Juan Pablo17mo ago
I already asked, and it got buried in the v14 help channel I guess I can try and post it in <#937420598383108167>
Solution
Juan Pablo
Juan Pablo17mo ago
"resolutions": {
"@discordjs/util": "0.1.1-dev.1675598630-405f940.0"
},
"resolutions": {
"@discordjs/util": "0.1.1-dev.1675598630-405f940.0"
},