我正在尝试创建一个简单的 javascript 作为 Discord 的 webhook。我已经删除了网址。
const DiscordWebhook = require("discord-webhooks");
let myWebhook = new DiscordWebhook("removedtopostonstackexchange")
myWebhook.on("ready", () => {
myWebhook.execute({
content:"Hello from a webhook",
username:"Mr Webhook",
avatar_url:"https://example.com/image.png"});});
myWebhook.on("error", (error) => {console.warn(error);});
当我在 runkit 中运行它时,它工作正常,并且成功的推送被发送到 Discord 频道,但是,上传到我的 linux 服务器返回以下错误:
[root@pikachu crash-watcher]# node test.js
/servers/crash-watcher/test.js:2
let myWebhook = new DiscordWebhook("removedtopostonstackexchange
^^^^^^^^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:945:3
[root@pikachu crash-watcher]#
谁能建议可能是什么问题?