问题
I am trying to create a discord bot, however receive this error every time I try to run a youtube link.
Error: FFmpeg/avconv not found!
at Function.getInfo (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:130:11)
at Function.create (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:143:38)
at new FFmpeg (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:44:27)
at AudioPlayer.playUnknown (C:\Users\-\discord-bot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20)
at VoiceConnection.play (C:\Users\-\discord-bot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28)
at Object.play (C:\Users\-\discord-bot\commands\play.js:78:8)
at Object.execute (C:\Users\-\discord-bot\commands\play.js:48:16)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14004) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\Users\-\discord-bot\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14004) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandl
ed promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14004) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I installed ffmpeg with npm install -g ffmpeg-binaries to try and install it globally. I also added ffmpeg to PATH, but that did not seem to work.
Anyway to fix it?
回答1:
Are you using this method? https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=play
As you didn't provide any code...
I had the same issue, that day i did two things, but i don't know which one was the fix.
- Actaullay download FFMPEG http://ffmpeg.org/download.html - put executable (ffmpeg.exe) in project directory EDIT: Don't download source code, download from Get packages & executable files for your OS
- Update node.js to newest version https://nodejs.org/en/
I'm not sure which one of the fixes it was. But now it also works without the file in directory, so I'm kinda confused
Also try requiring ffmpeg-binaries in the js file
来源:https://stackoverflow.com/questions/60925319/i-am-getting-this-error-ffmpeg-avconv-not-found