最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Linux上的Dİscord.js

网站源码admin16浏览0评论

Linux上的Dİscord.js

Linux上的Dİscord.js

我使用Windows,现在我切换到Linux。使用Windows时,我使用“ node bot.js”命令运行discord.js机器人。我无法在Linux上运行此命令。我再次使用命令“ npm init”创建了bot ID,并将测试命令设置为“ node bot.js”,但再次出现了错误。我需要你的帮助。 (Linux Mint 64位)

错误输出:/home/blour/Desktop/ew/node_modules/discord.js/src/client/Client.js:41

} catch {
        ^

SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/blour/Desktop/ew/node_modules/discord.js/src/index.js:8:11)
回答如下:

我从您的错误中假定您正在尝试使用try/catch语句,您需要为该语句的catch部分提供一个error参数:

try {
// Do something
} catch (error) {
// Do something with 'error'
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论