Discord Bot throws "FFMPEG not found" exception during voice channel operations

I’m working on a Discord bot using Node.js on a Windows 64-bit system. After setting up my project with npm init and installing the necessary packages:

npm install discord.js --save
npm install ffmpeg --save

I created a basic bot with voice capabilities. Here’s the relevant code snippet:

if (message.content === '!start' && message.member.roles.has(message.guild.roles.find("name", settings.admin_role).id)) {
    if (!message.member.voiceChannel) return console.log("User not in voice channel");
    message.member.voiceChannel.join().then(function (voiceConnection){
        // Voice connection logic here
    });
}

When I attempt to use the bot command in Discord, I receive this error:

[1517932146] Music bot initialized
(node:35760) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: FFMPEG not found

I’ve attempted:

  • Reinstalling all packages
  • Using various require statements
  • Simplifying the bot code

None of these solutions worked. Has anyone seen this FFMPEG error before?

Fix:

npm i [email protected]

Had the same issue when I started with Discord bots. Discord.js needs the actual FFMPEG executable for audio streams, not just the npm wrapper. When you run npm install ffmpeg, you’re only getting a Node.js wrapper that calls the real FFMPEG binary - but that binary doesn’t exist on your system. Your ffmpeg-binaries solution works because it includes the precompiled executables. I also had success downloading FFMPEG directly from Download FFmpeg, extracting it to a folder, then adding that folder to your Windows PATH. This lets Discord.js find ffmpeg.exe when processing audio. Both methods work, but ffmpeg-binaries is way more convenient.

Totally agree! Had the same issue when I started. The npm ffmpeg package won’t work for bots - you need actual binaries. Your solution with [email protected] is spot on, especially if you’re running older discord.js versions. You can also manually set the ffmpeg path if it’s already installed on your system.

The npm ffmpeg package is just a wrapper - it doesn’t include the actual FFMPEG binaries that Discord.js needs for audio processing. Installing ffmpeg-binaries is definitely the right move since it gives you the actual executable files. I ran into this exact issue when I deployed my music bot to a VPS. Discord.js expects to find ffmpeg in your system PATH or as accessible binaries. On Windows, you could download FFMPEG from the official website and add it to your system PATH, but ffmpeg-binaries is way simpler for development. Just heads up - ffmpeg-binaries will bloat your node_modules since it includes platform-specific binaries. For production, I’d install FFMPEG system-wide instead.