我收到此“错误:找不到FFmpeg / avconv!”
我正在尝试创建一个Discord机器人,但是每次尝试运行youtube链接时都会收到此错误。
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.
我用 npm install -g ffmpeg-binaries
安装了ffmpeg尝试在全球范围内安装。我还向PATH中添加了ffmpeg,但这似乎没有用。
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.
是否可以修复它?
您是否正在使用此方法?
https://discord.js。 org /#/ docs / main / stable / class / VoiceConnection?scrollTo = play
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下载FFMPEG http://ffmpeg.org/download.html-将可执行文件(ffmpeg.exe)放在项目目录编辑中:不要下载源代码,请从获取软件包下载
。适用于您操作系统的可执行文件 - 将node.js更新为最新版本 https://nodejs.org/en/
- Actaullay download FFMPEG http://ffmpeg.org/download.html - put executable (ffmpeg.exe) in project directory 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
还尝试要求 ffmpeg-binaries
在js文件中
Also try requiring ffmpeg-binaries
in the js file