最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Discord.js Music Bot ffmpeg not found? - Stack Overflow

programmeradmin0浏览0评论

I just started learning javascript with node.js and I am attempting to create a music bot, I've set up the mand handler and everything, however, I keep getting this error when I try to run the play mand

Error: FFmpeg/avconv not found! at Function.getInfo (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\prism-media\src\core\FFmpeg.js:130:11) at Function.create (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\prism-media\src\core\FFmpeg.js:143:38) at new FFmpeg (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\prism-media\src\core\FFmpeg.js:44:27) at AudioPlayer.playUnknown (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20) at VoiceConnection.play (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28) at C:\Users\johnd\OneDrive\Desktop\discordBot\mands\play.js:7:39 at processTicksAndRejections (internal/process/task_queues.js:97:5)

I'll post my play function below

async function playMusic(vc,songId) {
    const stream = await ytdl(songId,{type: 'opus',filter : 'audioonly'});
    vc.join().then(connection => {
        const dispatcher = connection.play(stream,{volume: 1});
        dispatcher.on('end', end => {
            console.log("Song ended!");
            vc.leave();
        }).catch(err => console.log(err));
    }).catch(err => console.log(err));
}

My proof of installation: .jpg

Update 1: I'm still looking for others with this specific problem and can't find anything.

I just started learning javascript with node.js and I am attempting to create a music bot, I've set up the mand handler and everything, however, I keep getting this error when I try to run the play mand

Error: FFmpeg/avconv not found! at Function.getInfo (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\prism-media\src\core\FFmpeg.js:130:11) at Function.create (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\prism-media\src\core\FFmpeg.js:143:38) at new FFmpeg (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\prism-media\src\core\FFmpeg.js:44:27) at AudioPlayer.playUnknown (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20) at VoiceConnection.play (C:\Users\johnd\OneDrive\Desktop\discordBot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28) at C:\Users\johnd\OneDrive\Desktop\discordBot\mands\play.js:7:39 at processTicksAndRejections (internal/process/task_queues.js:97:5)

I'll post my play function below

async function playMusic(vc,songId) {
    const stream = await ytdl(songId,{type: 'opus',filter : 'audioonly'});
    vc.join().then(connection => {
        const dispatcher = connection.play(stream,{volume: 1});
        dispatcher.on('end', end => {
            console.log("Song ended!");
            vc.leave();
        }).catch(err => console.log(err));
    }).catch(err => console.log(err));
}

My proof of installation: https://i.sstatic/LRfJ4.jpg

Update 1: I'm still looking for others with this specific problem and can't find anything.

Share Improve this question edited Mar 16, 2020 at 13:49 cccmdm asked Mar 16, 2020 at 12:32 cccmdmcccmdm 111 silver badge3 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

You need to run the following mands:

1) npm install ffmpeg-static
2) npm install @discordjs/opus
3) npm install ytdl-core

No need to install any binary or put it in the PATH, just install the above things like you installed discordjs. These things will show up in your package.json file after that. When you will host your bot in the cloud it will build it using the package.json.

have you added ffmpeg to the windows path yet?

here's a link to that, in case you haven't ===> https://www.youtube./watch?v=qjtmgCb8NcE

(be sure you have de .EXE on PATHEXT too)

ps.: I had the same problem, I restarted my puter and everything went to normal. And here's another link that could help https://www.npmjs./package/discord.js-music-v11

If his suggestion doesn't work try: run npm install FFmpeg-static and npm install @discordjs/opus

I was having the same issue and this is what worked

发布评论

评论列表(0)

  1. 暂无评论