Node.js 我得到这个“错误:找不到FFmpeg/avconv!”

Node.js 我得到这个“错误:找不到FFmpeg/avconv!”,node.js,ffmpeg,discord.js,Node.js,Ffmpeg,Discord.js,我正在尝试创建一个discord机器人,但是每次我尝试运行youtube链接时都会收到此错误 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

我正在尝试创建一个discord机器人,但是每次我尝试运行youtube链接时都会收到此错误

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安装-g ffmpeg二进制文件安装了ffmpeg,以尝试全局安装它。我还将ffmpeg添加到路径中,但这似乎不起作用

是否要修复它?

您是否使用此方法?

因为你没有提供任何代码

我也有同样的问题,那天我做了两件事,但我不知道哪一件是修复的

Actaullay下载FFMPEG-将可执行文件FFMPEG.exe放入项目目录编辑:不下载源代码,下载 从获取操作系统的软件包和可执行文件 将node.js更新为最新版本 我不确定是哪一个修复。但现在它也可以在目录中没有文件的情况下工作,所以我有点困惑


还可以尝试在js文件中要求ffmpeg二进制文件

尝试运行此npm i ffmpeg静态文件

我在Discord中播放流时遇到问题。js甚至认为我安装了ffmpeg二进制文件,所以这里有一个可能的修复方法,至少在windows中,如果ffmpeg不能在CMD中单独运行,然后我转到第115行的node_modules\prism media\src\core\FFmpeg.js,这里有一个数组,列出了每个可能使用的目录,例如FFmpeg,因此我从

}, 'ffmpeg', 'avconv', './ffmpeg', './avconv'];


它对我来说很好:

安装avconv和ffmpeg


它对我的作用是这样的

对于add ffmpeg,请转到此处:

找到这个:

通过添加Buildpack按钮添加此项:

是什么让您认为ffmpeg二进制文件正是您所需要的?我建议安装prism媒体自述文件包的依赖项部分中列出的依赖项之一。您是否尝试运行ffmpeg-h以确保系统找到它?嘿,我也有同样的问题,我做了一些挖掘和实验,我的问题与通过url传入的文件大小100%相关。因此,我可以播放纯静态图像和音频的youtube视频,就像播放歌曲的专辑封面,但我不能播放任何有音频的音乐视频。我看到了几个类似的问题,但仍然没有一个实际的解决方案。我会在找到时更新。如果你在我之前也这样做了,请在这里发布答案。添加exe文件修复了问题,但我如何使用github将此推送到heroku?只需像平常一样推。不要在GitIgnore中包含.exe文件这并不能回答这个问题。一旦你有足够的钱,你将能够;相反这很有效,非常感谢!工作!非常感谢。
}, 'ffmpeg', 'avconv', './ffmpeg', 'C:/ffmpeg/ffmpeg', './avconv'];