我希望在未定义类属性this.url的情况下,测试会出现抛出的错误。
我在这里做错什么了?
it('should throw an error if url is not provided by default', async () => {
// Given
const Service = require('./services/websocket')
// When
const Websocket = new Service()
// Then
expect(Websocket.url).toBe
我有一个关于Debian9不一致引导的问题,我试图运行我的代码,但是VPS抛给我这个错误。以前,我通常在另一个VPS上安装这个机器人,一切都正常工作,但现在它不工作了。我不知道我是否遗漏了任何模块或错误安装的节点和npm。
TypeError: fields.flat is not a function
at Function.normalizeFields (/home/bot/node_modules/discord.js/src/structures/MessageEmbed.js:443:8)
at MessageEmbed.addFields (/home/bot
ReferenceError: clinet is not defined
at Client.<anonymous> (/Users/gavinmartin/Desktop/myshadow/main.js:34:9)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (/Users/gavinmartin/Desktop/myshadow/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.modu
嘿,我在那里得到了这个错误,它在12小时或24小时后崩溃了,我必须重新启动它,有没有办法解决这个问题? 错误: /root/Chat/node_modules/ws/lib/websocket.js:334
throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
^
Error: WebSocket is not open: readyState 0 (CONNECTING)
at WebSocket.send (/root/Chat/node_modules/
我试过这样做:
if(!msg.author.hasPermission('MANAGE_MESSAGES')) return msg.channel.send(":x: You don't have permissions. :x:")
但它给了我这个错误:
TypeError: msg.author.hasPermission is not a function
at Client.bot.on.msg (D:\Development\Jaycobe [DISCORD]\index.js:28:28)
at Client.emit (events.
我想运行一个javascript程序,而不会在node.js中终止:--
这是using while(1);做这件事的正确方法吗?
在这个javascript程序中,我创建了一个websocket &向它列表。
每当数据出现在websocket上时,它就会抛到console.log上。
test.js :--
var tt = new websocket_fun();
function websocket_fun()
{
var temp = new websocket_create();
while(1);
}
function websocket_create()
我有一个问题:当我添加角色成员时,我的机器人在我的主服务器上崩溃(reuuu在dev服务器上),在dev服务器上,角色reuuu工作得很好。
我不明白这个错误。
^
TypeError: Cannot read property 'hasPermission' of null
at Client.<anonymous> (/home/container/index.js:96:23)
at Client.emit (events.js:326:22)
at MessageCreateAction.
我在我的控制台中得到了这个错误:
(node:33480) UnhandledPromiseRejectionWarning: TypeError: Function.prototype.apply was called on #<Object>, which is
a object and not a function
at MessageCollector.handleCollect (C:\Users\RIJAK\Documents\GitHub\asta-jr\node_modules\discord.js\src\structures\interfaces\Co
我试图使用WebSocket websocket客户端:连接到一个nodeJS地址(例如:'wss://mycompany.com')。我能够成功地使用在浏览器中测试连接,但在使用nodeJS WebSocket客户端时得到以下连接错误:
error: Error: Unexpected server response: 403
at ClientRequest.<anonymous> (oda-node-sdk\node_modules\ws\lib\websocket.js:579:7)
at ClientRequest.emit (events.js:
我有这个问题,我无法发送消息到特定的通道,我可以使用此代码发送消息:
let Channel = message.guild.channels.cache.get("749002989255131227");
Channel.send("Hello!")
但当我尝试发送它时,出现了错误:
(node:13580) UnhandledPromiseRejectionWarning: TypeError: Channel.send is not a function
at Client.<anonymous> (C:\Users\alier\De
我已经在我的node.js安装上成功运行了socket.io。
info - socket.io started
控制台显示它运行正常,但一旦客户端(浏览器)连接:
socket = io.connect('<my host>:8000');
控制台正在排除一个错误:
crypto.js:123
return new Hash(hash);
^
TypeError: undefined is not a function
at Object.createHash (crypto.js:123:10)
at WebSocket.
我让节点从一个码头容器中运行,我试图编写一些websocket示例。但我遇到了下一个问题:
root@7cd5a41c8eea:/application/webSocketEx# node
> var connection = new WebSocket('ws://html5rocks.websocket.org/echo', ['soap', 'xmpp']);
ReferenceError: WebSocket is not defined
> const WebSocket = require('ws');
u
这就是我试图通过WebSocket从Leap Motion设备的帧中获取特定元素的方法。
var webSocket = require('ws');
ws = new webSocket('ws://127.0.0.1:6437');
ws.on('message', function(data, flags) {
var frame = JSON.parse(data);
var id = frame.hands;
var pos = id[0];
console.log(pos);
});
JSON对象看起
我正面临着discord.js的一个问题。在定义通道时:
client.on("guildMemberAdd", member => {
var role = member.guild.roles.find(role => role.name === "Member");
member.addRole(role);
var channel = member.guild.channels.find("name", "welcome")
channel.send("Welcome to the se