discordjs / guide

The official guide for discord.js, created and maintained by core members of its community.
https://discordjs.guide
MIT License
1.57k stars 2.3k forks source link

Cannot find module "node_modules\@discordjs\voice\dist\index.js" #1571

Closed KendrickMichaud123 closed 4 months ago

KendrickMichaud123 commented 4 months ago

Describe the bug

I followed the steps provided from "https://discordjs.guide/voice/voice-connections.html#creation" on how to create a voice connection. I installed discord.js and I also ran "npm install @discordjs/voice libsodium-wrappers" but for some reason it crashes on the lack of the index.js

To Reproduce

Install discord.js npm install @discordjs/voice libsodium-wrappers

Then include the code snippet

const { joinVoiceChannel } = require('@discordjs/voice');

// const connection = joinVoiceChannel({
//  channelId: channel.id,
//  guildId: channel.guild.id,
//  adapterCreator: channel.guild.voiceAdapterCreator,
});

Screenshots

No response

Device (please complete the following information)

Windows 10 npm v20.11.0 @discordjs/voice github:discordjs/voice discord.js ^14.15.3

Additional notes

No response

KendrickMichaud123 commented 4 months ago

Nothing that needs to be fixed. Guides online are not up to date with documentation from your site. This issue is solved.

KendrickMichaud123 commented 4 months ago

For anyone who has module issues please use this code exactly as written. In my case I did import { joinVoiceChannel }... which is not proper for this.


const { joinVoiceChannel } = require('@discordjs/voice');

const connection = joinVoiceChannel({
    channelId: channel.id,
    guildId: channel.guild.id,
    adapterCreator: channel.guild.voiceAdapterCreator,
});```