我正在尝试创建一个不和谐的bot,但是每次我尝试运行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,以尝试在全球安装它。我还向PATH中添加了ffmpeg,但这似乎没有用。
是否要修复它?
答案 0 :(得分:4)
您使用这种方法吗? https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=play
因为您没有提供任何代码...
我遇到了同样的问题,那天我做了两件事,但我不知道哪个是解决问题的
我不确定它是哪个修复程序。但是现在它也可以在目录中没有文件的情况下工作,所以我有点困惑
还尝试在js文件中要求ffmpeg-binaries
答案 1 :(得分:4)
尝试运行此reloadData()
答案 2 :(得分:1)
我在Discord.js中播放流时遇到问题,甚至以为我安装了ffmpeg二进制文件,因此这是一个可能的解决方法,如果 ffmpeg 不能在CMD中单独运行,则至少在Windows中运行,然后我在第115行转到了node_modules \ prism-media \ src \ core \ FFmpeg.js,并且在每个可能使用的目录都有一个数组,例如ffmpeg,所以我从
}, 'ffmpeg', 'avconv', './ffmpeg', './avconv'];
到
}, 'ffmpeg', 'avconv', './ffmpeg', 'C:/ffmpeg/ffmpeg', './avconv'];
对我来说很好:)
答案 3 :(得分:0)
要添加 ffmpeg,请转到此处:
https://dashboard.heroku.com/apps/YOURAPPNAME/settings
通过“Add Buildpack”按钮添加: https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest
答案 4 :(得分:-1)
安装 avconv 和 ffmpeg
它像这样对我有用