javascript - 为什么我已经安装了错误查找模块
问题描述
我正在尝试编写一个不和谐的音乐机器人,这是我的代码:
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!
解决方案
推荐阅读
- java - 我可以像这样使用 .setMinimumFetchIntervalInSeconds(43200) 发布我的应用程序吗?
- android - 片段不显示整个回收站视图。它只显示一个卡片视图
- c# - 使用 LINQ 使用具有多重继承的对应子对象的组列表
- r - 创建一个循环以将遇到的数据下载并写入 csv
- gradle - 下面的 gradle 任务有什么问题?
- sql-server - 查询 XML 列
- css - 为什么使用 :host ::ng-deep 将 CSS 角色设置为角度组件 CSS 不起作用?
- c++ - 找出两个 8 位二进制状态之间的差异
- php - PHP致命错误:调用未定义的函数Laravel tinker
- java - 在 Android 10 上使用 action_call 意图拨打电话不起作用