javascript - 为什么我已经安装了错误查找模块

标签 javascript node.js npm ffmpeg

我正在尝试编写一个不和谐的音乐机器人,这是我的代码:

const config = require('config.json')
const Discord = require('discord.js');
const ffmpeg = require('ffmpeg-extra')
const client = new Discord.Client();

client.once('ready', () => {
    console.log('Ready!');
});
client.on('message', message => {
    if(message.content.toLocaleLowerCase() === "elevator"){
        if(message.member.voice.channel){
            message.channel.send("Thanks to https://www.bensound.com for supplying us with this music.")
            play(message.member.voice.channel)
        }
        else {
            message.channel.send("Yo, please join a VC first.")
        }
    }
});

async function play(voiceChannel) {
    const connection = await voiceChannel.join();
    connection.play('elevator.mp3');
}

client.login(config.token);

出于某种原因,即使我通过 npm install ffmpeg 安装了 ffmpeg,它也会说:
Error: Cannot find module 'ffmpeg-extra'

编辑:当我使用 const ffmpeg = require("ffmpeg") 我得到这个错误:
UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!

最佳答案

我认为你需要错误的包。
ffmpeg-extra不是公共(public)包。
ffmpeg存在 here .
extra-ffmpeg存在 here .

也许您必须要求这两个软件包之一。

关于javascript - 为什么我已经安装了错误查找模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61777601/

相关文章:

javascript - 单击页面加载时的 HTML 按钮/链接

javascript - 如何使用 React.cloneElement 将 Prop 传递给 child ?

node.js - 如何在 443 中为 apache 和 Node 配置 https 支持?

node.js - 如何在node.js中复制文件(包括修改时间)?

node.js - 收到错误 args.includes is not a function Node js

javascript - 使用 ui-router 切换状态时保留 $scope

javascript - 如何使用 CORS 向多个域验证同一用户的身份?

mysql - 产品过滤器 Node js + sequelize

node.js - npm v5.0 还没有 yarn 的哪些特性?

node.js - 需要帮助建立nodejs (NPM) localhost https