简体   繁体   English

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

[英]“Error: FFMPEG not found”: Error with simple Discord Bot

I'm using Windows (64-bit) with Node.js and npm installed.我正在使用安装了 Node.js 和 npm 的 Windows(64 位)。 In my project file, I have run the following commands:在我的项目文件中,我运行了以下命令:

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

Now i just created the code for a basic bot here is the main code.现在我刚刚为基本机器人创建了代码,这里是主要代码。 I list here the important:我在这里列出了重要的:

 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){      
       });
 }

Then, in Discord, I say the following:然后,在 Discord 中,我说以下内容:

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

I have already tested the following:我已经测试了以下内容:

  • reinstallation of everything重新安装一切
  • others of the require names etz其他需要名称 etz
  • simplify the code简化代码

So if you have any ideas then let me know.因此,如果您有任何想法,请告诉我。

Solution解决方案

npm i ffmpeg-binaries@3.2.2-3

link链接

You need to actually install ffmpeg, the ffmpeg module on NPM simply exports a wrapper API for ffmpeg's command-line interface.您需要实际安装 ffmpeg,NPM 上的ffmpeg模块只是为 ffmpeg 的命令行界面导出包装器 API。

You can download ffmpeg's binaries from the website or use a package manager (like apt on Ubuntu, brew on Mac or choco on Windows) which usually takes care of dropping the binaries into a directory that is present in the PATH .您可以从网站下载 ffmpeg 的二进制文件或使用包管理器(如 Ubuntu 上的apt 、Mac 上的brew或 Windows 上的choco ),它通常负责将二进制文件放入PATH存在的目录中。

As far as I can see, you never actually installed ffmpeg .据我所知,您从未真正安装过ffmpeg Using the ffmpeg node module won't get you anywhere unless you install the binaries.除非您安装二进制文件,否则使用ffmpeg节点模块不会让您到任何地方

You can also use apt , brew or in your case choco which makes things go alot faster.您还可以使用aptbrew或在您的情况下使用choco ,这使事情进展得更快。 Here is a guide on how to do it in windows.这是有关如何在 Windows 中执行此操作的指南。

Once it is installed you will be able to use many node modules such as opusscript and much more.安装后,您将能够使用许多节点模块,例如opusscript等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM