使用--inspect-brk选项时,WebSockets请求是预期的错误 [英] WebSockets request was expected error when using --inspect-brk option

查看:227
本文介绍了使用--inspect-brk选项时,WebSockets请求是预期的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行 nodemon dist/server/app.js 时,它可以在默认端口 3000 上运行,并且可以访问我的API.但是,如果我运行 nodemon --inspect-brk = localhost:3000 dist/server/app.js ,则会收到错误消息,提示期望WebSockets请求".怎么了?

When I run nodemon dist/server/app.js it works on default port 3000 and I'm able to reach my API. But if I run nodemon --inspect-brk=localhost:3000 dist/server/app.js, I got error saying "WebSockets request was expected". What's wrong?

推荐答案

您不能在同一端口上运行Web服务器和调试器.它们分别是单独的服务器(调试器是内置在node.js运行时中的服务器).

You can't run your web server and the debugger on the same port. They are each separate servers (the debugger is a server built into the node.js runtime).

因此,您可以从-inspect-brk 选项中删除端口和主机名称,然后让其使用默认值(这是我所使用的全部),或者可以选择其他选项调试器的端口,该端口与您的网络服务器或该主机上运行的任何其他服务器都没有冲突.

So, you can either remove the port and host designation from the --inspect-brk option and just let it use the defaults (which is all I ever use) or you can select a different port for the debugger that doesn't conflict with your web server or anything else running on that host.

这篇关于使用--inspect-brk选项时,WebSockets请求是预期的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆