如何解决mineflayer机器人报错Unsupported brand channel name
解决Mineflayer机器人报错:Unsupported brand channel name
问题详情
开发Mineflayer机器人时反复出现Unsupported brand channel name错误,使用的代码如下:
const mineflayer = require('mineflayer') const bot = mineflayer.createBot({ host: 'localhost', port: , username: 'Test_Bot' })
完整报错信息:
Error: Unsupported brand channel name at getBrandCustomChannelName (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugins/game.js:22:11) at inject (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugins/game.js:67:24) at /Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugin_loader.js:41:7 at Array.forEach (<anonymous>) at injectPlugins (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugin_loader.js:40:16) at EventEmitter.onInjectAllowed (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugin_loader.js:12:5) at Object.onceWrapper (node:events:627:28) at EventEmitter.emit (node:events:513:28) at Client.next (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugin_loader.js:124:9) at Object.onceWrapper (node:events:627:28)
先后尝试局域网服务器、online-mode设为false的私人服务器,问题均未解决。
修复步骤
补充端口号并指定Minecraft版本
原代码中port参数为空,先补充默认端口25565(或你的服务器实际端口),同时明确指定服务器对应的Minecraft版本,避免版本不兼容:const mineflayer = require('mineflayer') const bot = mineflayer.createBot({ host: 'localhost', port: 25565, username: 'Test_Bot', version: '1.19.2' // 替换为你的服务器实际版本号 })更新Mineflayer到最新版本
打开项目终端执行以下命令,更新依赖到最新稳定版,修复已知的协议兼容问题:npm update mineflayer排查服务器插件冲突
如果服务器安装了自定义客户端品牌标识的插件,暂时禁用这类插件后重新测试,确认是否是插件修改了协议通道导致报错。
内容的提问来源于stack exchange,提问作者Kimchisundae
相关产品推荐
相关产品推荐

