久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Heroku 上的 Discord 機器人拋出錯誤:agent ??= new htt

Discord bot on Heroku throws an error: agent ??= new https.Agent(Heroku 上的 Discord 機器人拋出錯誤:agent ??= new https.Agent)
本文介紹了Heroku 上的 Discord 機器人拋出錯誤:agent ??= new https.Agent的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

這與我的第一個問題有關.我更新了所有代碼.在我的 bot.js 中是:

This is related to my first question. I updated all of my codes. In my bot.js is:

require('dotenv').config();

let ver = process.env.DISCORD_BOT;

client.once('ready', async () => {
  if (ver === 'production') {
    client.user.setActivity(`in code land`, { type: 'PLAYING' });
  } else {
    client.user.setActivity(`over ${client.guilds.cache.size} server(s)`, {
      type: 'WATCHING',
      status: 'IDLE',
    });
  }
  console.log(`Logged in as ${client.user.tag}!`);
  console.log(`the prefix is ` + prefix);
});

過程文件:

worker: node bot.js

package.json:

 "scripts": {
    "start": "node .",
    "test": "echo "Error: no test specified" && exit 1",
    "production": "NODE_ENV=production&&npm start",
    "development": "set NODE_ENV=development&&npm start"
  }

.env:

DISCORD_BOT= TOKEN

當我檢查 Heroku 應用程序日志時,拋出的錯誤如下:

When I checked the Heroku application logs here's the error thrown:

2021-12-22T03:13:05.436081+00:00 app[worker.1]: 代理??= new https.Agent({ ...this.client.options.http.agent, keepAlive:真 });

2021-12-22T03:13:05.436081+00:00 app[worker.1]: agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });

2021-12-22T03:13:05.436082+00:00 應用[worker.1]: ^^^

2021-12-22T03:13:05.436082+00:00 app[worker.1]: ^^^

2021-12-22T03:13:05.436082+00:00 應用[worker.1]:

2021-12-22T03:13:05.436082+00:00 app[worker.1]:

2021-12-22T03:13:05.436082+00:00 app[worker.1]: SyntaxError:意外的令牌'??='

2021-12-22T03:13:05.436082+00:00 app[worker.1]: SyntaxError: Unexpected token '??='

我嘗試搜索 SyntaxError: Unexpected token '??='" 并且每個結果都建議將 node.js 更新到 v16-17 但我已經在使用最新版本的 Discord.js 和 Node.js.

I've tried to search for the "SyntaxError: Unexpected token '??='" and every single result is suggesting to update node.js to v16-17 but I'm already using the latest version of both Discord.js and Node.js.

推薦答案

錯誤來自 discord.js,因為您使用的是舊版本的 Node.js.邏輯空賦值運算符 (??=) 僅 在節點 v15+ 中可用.

The error is coming from discord.js and it's because you're using an older version of Node.js. The logical nullish assignment operator (??=) is only available in node v15+.

您可能認為您使用的是最新版本的 Node.js,但 Heroku 表示 如果引擎中未指定 Node 版本,將使用 14.x 版本".你可以在 package.json 文件中添加一個 engines 屬性來指定你需要的版本.由于 discord.js v13 需要 node.js v16.6+,您可以添加以下內容:

You might think that you're using the latest version of Node.js, but Heroku says that "if a Node version isn't specified in the engine, the 14.x release will be used". You can add an engines prop to your package.json file to specify the version you need. As discord.js v13 requires node.js v16.6+, you can add the following:

  "engines": {
    "node": "16.6"
  }

或者請求最新的 v16,添加這個:

Or to request the latest v16, add this:

  "engines": {
    "node": "16.x"
  }

這篇關于Heroku 上的 Discord 機器人拋出錯誤:agent ??= new https.Agent的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using discord.js to detect image and respond(使用 discord.js 檢測圖像并響應)
Check if user ID exists in Discord server(檢查 Discord 服務器中是否存在用戶 ID)
Guild Member Add does not work (discordjs)(公會成員添加不起作用(discordjs))
Creating my first bot using REPLIT but always error Discord.JS(使用 REPLIT 創建我的第一個機器人,但總是錯誤 Discord.JS)
How do I code event/command handlers for my Discord.js bot?(如何為我的 Discord.js 機器人編寫事件/命令處理程序?)
How to find a User ID from a Username in Discord.js?(如何從 Discord.js 中的用戶名中查找用戶 ID?)
主站蜘蛛池模板: 羞羞视频网站免费看 | 成人精品一区二区三区中文字幕 | 久久精品一区二区三区四区 | 亚洲性人人天天夜夜摸 | 国产女人与拘做受视频 | 日本一区二区高清不卡 | 国产精品a一区二区三区网址 | 亚洲激情综合 | 日韩精品免费一区 | 2019精品手机国产品在线 | 在线欧美激情 | 国产成人精品一区二区三 | 国产精品一区二区三区四区 | 新超碰97 | 久久国产精品免费一区二区三区 | 国产高清视频 | 国产综合在线视频 | 久久久国产精品 | 亚洲中字在线 | 天堂久久天堂综合色 | 久久美国 | 日韩a在线观看 | 亚洲精品www | 国精产品一区一区三区免费完 | 欧美国产中文字幕 | 操到爽 | 国产精品久久久久久久久久三级 | 三级特黄特色视频 | 欧美福利 | 久久久妇女国产精品影视 | 国产精品日日做人人爱 | 少妇精品亚洲一区二区成人 | 亚洲成人自拍 | gogo肉体亚洲高清在线视 | 手机看片在线播放 | 成人久久18免费网站 | 天天爽天天操 | 久久久精品一区二区三区 | 懂色av一区二区三区在线播放 | 91久久精品日日躁夜夜躁国产 | 日本不卡一二三 |