“错误:找不到FFMPEG”:简单的Discord Bot出错

时间:2018-02-06 16:05:39

标签: javascript node.js ffmpeg discord discord.js

我正在使用安装了Node.js和npm的Windows(64位)。 在我的项目文件中,我运行了以下命令:

npm init
npm install discord.js --save
npm install ffmpeg --save

现在我刚刚创建了基本机器人here的代码是主要代码。 我在这里列出了重要内容:

 if (message.content === '!play' && message.member.roles.has(message.guild.roles.find("name", config.role_name).id)) {
    if (!message.member.voiceChannel) return log("?");
       message.member.voiceChannel.join().then(function (connection){      
       });
 }

然后,在Discord中,我说以下内容:

 [1517932146]  Musik bot loaded
    (node:35760) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: FFMPEG not found

我已经测试了以下内容:

  • 重新安装所有内容
  • 其他要求名称e.t.z。
  • 简化代码

所以,如果您有任何想法,请告诉我。谢谢

2 个答案:

答案 0 :(得分:1)

你需要实际安装ffmpeg,NPM上的ffmpeg模块只是为ffmpeg的命令行界面导出一个包装器API。

你可以下载ffmpeg的二进制文件from the website或者使用软件包管理器(比如Ubuntu上的apt,Mac上的brew或Windows上的choco),这通常会照顾掉线将二进制文件存入PATH中的目录。

答案 1 :(得分:0)

据我所知,你从未真正安装ffmpeg。除非install the binaries.

,否则使用ffmpeg节点模块无法将您带到任何地方

您还可以使用aptbrewchoco,这会让事情变得更快。 Here is a guide on how to do it in windows.

安装完成后,您将能够使用许多节点模块,例如opusscript等等。