尝试启动Discord机器人时出现“错误:无法验证第一个证书”

时间:2018-10-03 22:08:58

标签: node.js visual-studio-code discord.js

使用Visual Studio Code&Node设置Discord机器人时遇到错误。
这是使机器人联机的代码:

const Discord = require('discord.js');
const bot = new Discord.Client();
bot.login('[the token i recieved for my bot]');

运行此错误消息是:

(node:7064) UnhandledPromiseRejectionWarning: Error: unable to verify the first certificate    warning.js:18
 at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
 at TLSSocket.emit (events.js:182:13)
 at TLSSocket._finishInit (_tls_wrap.js:631:8)
(node:7064) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either 
 by throwing inside of an async function without a catch block, or by rejecting a promise which was not
 handled with .catch(). (rejection id: 2)    warning.js:18
(node:7064) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future,
 promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.    warning.js:18

有人可以帮助我调试此错误或无法得到此错误吗?

1 个答案:

答案 0 :(得分:0)

使用完全相同的设置,我无法重现您的错误。

  

discord.js: v11.4.2Visual Studio Code: v1.28.2

如果您仍然遇到此问题,请maybe this can help you