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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48647177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 04:12:08  来源:igfitidea点击:

"Error: FFMPEG not found": Error with simple Discord Bot

javascriptnode.jsffmpegdiscorddiscord.js

提问by Robin Seerig

I'm using Windows (64-bit) with Node.js and npm installed. In my project file, I have run the following commands:

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

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

Now i just created the code for a basic bot hereis 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 e.t.z.
  • simplify the code
  • 重新安装一切
  • 其他需要名称 etz
  • 简化代码

So if you have any ideas then let me know.

因此,如果您有任何想法,请告诉我。

Solution

解决方案

npm i [email protected]

link

关联

回答by Sven

You need to actually install ffmpeg, the ffmpegmodule on NPM simply exports a wrapper API for ffmpeg's command-line interface.

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

You can download ffmpeg's binaries from the websiteor use a package manager (like apton Ubuntu, brewon Mac or chocoon Windows) which usually takes care of dropping the binaries into a directory that is present in the PATH.

您可以从网站下载 ffmpeg 的二进制文件或使用包管理器(如apt在 Ubuntu、brewMac 或chocoWindows 上),它通常负责将二进制文件放入PATH.

回答by Aidan el Goste

As far as I can see, you never actually installed ffmpeg. Using the ffmpegnode module won't get you anywhere unless you install the binaries.

据我所知,您实际上从未安装过ffmpeg. ffmpeg除非您安装二进制文件,否则使用node 模块不会让您到任何地方

You can also use apt, brewor in your case chocowhich makes things go alot faster. Here is a guide on how to do it in windows.

您也可以使用apt,brew或者在您的情况下choco使事情进展得更快。这是有关如何在 Windows 中执行此操作的指南。

Once it is installed you will be able to use many node modules such as opusscriptand much more.

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