我正在尝试创建一个不和谐的机器人,但是每次我尝试运行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 install -g ffmpeg-binaries安装了ffmpeg,尝试在全局范围内安装它。我还将ffmpeg添加到路径中,但这似乎不起作用。
不管怎么说,怎么解决它?
发布于 2020-06-21 03:53:10
尝试运行此npm i ffmpeg-static
发布于 2020-03-30 15:32:42
你正在使用这种方法吗?https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=play
因为你没有提供任何代码...
我也有同样的问题,那天我做了两件事,但我不知道哪一件是解决的。
http://ffmpeg.org/download.html -将可执行文件(ffmpeg.exe)放入项目目录中进行编辑:不要下载源代码,请从Get packages & executable files OS
我不确定是哪一个修复。但是现在它也可以在目录中没有文件的情况下工作,所以我有点困惑
还可以尝试在js文件中要求ffmpeg-binaries
发布于 2020-06-27 05:37:05
尽管我安装了ffmpeg二进制文件,但我在Discord.js中播放流时遇到了问题,所以这里有一个可能的修复,至少在windows中,如果ffmpeg不能在CMD中单独运行,那么我转到第115行的node_modules\prism-media\src\\FFmpeg.js,这里有一个包含每个可能目录的数组,例如ffmpeg,所以我从
}, 'ffmpeg', 'avconv', './ffmpeg', './avconv'];至
}, 'ffmpeg', 'avconv', './ffmpeg', 'C:/ffmpeg/ffmpeg', './avconv'];它对我来说工作得很好:)
https://stackoverflow.com/questions/60925319
复制相似问题