Mineflayer - options.username = options.username ?? 'Player'错误



我试图学习如何编程Minecraft Bot,我找到了Minelayer。一切都很好,但当我运行程序时,我总是得到:

/home/runner/Minecraft-Bot/node_modules/mineflayer/index.js:63
options.username = options.username ?? 'Player'
^
SyntaxError: Unexpected token '?'

错误消息我得到

我使用了Minelayer GitHub页面,逐字逐句地跟踪,但我的代码仍然无法运行。你知道为什么会这样吗?谢谢我的代码

根据堆栈跟踪中的代码行:Node.js无法解释??语法构造。"?"被称为零合并运算符,是ECMAScript的新添加,因此它只在最近的运行时中受支持。请确保您正在运行Node.js 14.x或更高版本。

最新更新