久久久久久久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?)
主站蜘蛛池模板: www.中文字幕.com | 精品亚洲一区二区三区四区五区 | 亚洲免费精品 | 久久精品国产久精国产 | 午夜影院| 国产真实乱全部视频 | www.国产精| 精品一区二区三区四区外站 | 成人精品区 | 这里只有精品999 | 中文字幕av一区 | 国产乱码精品一区二区三区忘忧草 | 国产激情偷乱视频一区二区三区 | 97成人在线 | 久久精品国产免费高清 | 亚州精品天堂中文字幕 | 国产精品美女久久久久 | 国产一区二区三区在线免费 | 中文字幕成人 | 亚洲性爰 | 亚洲视频一区二区 | 成人亚洲视频 | 国产精品区一区二 | 国产成人精品a视频一区www | av先锋资源| 久久久久国产一区二区 | 91亚洲精品久久久电影 | 国产成人aⅴ | 国产精品69av| 中文字幕一区二区三区四区五区 | 亚洲激情视频在线 | 91久久国产综合久久 | 中文字幕一区二区三区在线乱码 | 亚洲天堂色 | 亚洲在线 | 在线观看成人免费视频 | 国产成人精品久久 | 久久国内 | 亚洲一区二区视频 | 亚洲一区国产 | 欧美精品在线播放 |