当我启动我的服务器:
ROOT_URL="http://myserver:24000" meteor debug --settings config/settings.json --port 24000 --inspect
我得到控制台日志:
Debugger listening on ws://127.0.0.1:9229/a540a686-0a99-4a2a-ae85-bf06f74bc274
For help see https://nodejs.org/en/docs/inspector
但是,当我尝试访问http://myserver:9229/a540a686-0a99-4a2a-ae85-bf06f74bc274我得到网站不可用....
我在用:
Meteor v1.8.0.2
Node: v8.11.4
注意:我想远程调试,我不在我的meteor应用程序运行的同一台机器上。
要远程调试您的Meteor应用程序,您现在只需use the node internal inspector并省略debug
命令:
ROOT_URL="http://myserver:24000" meteor --inspect --settings config/settings.json --port 24000
它现在像往常一样使用公共端口24000运行您的Meteor应用程序。现在控制台应该显示以下输出:
=> Started proxy.
=> Started MongoDB.
W20190218-21:01:14.539(1)? (STDERR) Debugger listening on ws://127.0.0.1:9229/2ee5da2d-c15b-416a-9efc-a19bb1299f35
W20190218-21:01:14.552(1)? (STDERR) For help see https://nodejs.org/en/docs/inspector
=> Started your app.
=> App running at: http://myserver:24000/
为了远程调试服务器端代码,您需要将node inspector client附加到ws://127.0.0.1:9229/2ee5da2d-c15b-416a-9efc-a19bb1299f35
,这是一个基于websocket的位置,不能通过http://...
使用。
如果您使用chrome,您只需输入chrome://inspect
并查看Remote Target
列表,其中应该有您的Meteor应用程序Target (v8.11.4)
(这是Meteor 1.8.0.2的内部node
版本)的条目。单击inspect
,控制台现在应该打印
W20190218-21:08:48.039(1)? (STDERR) Debugger listening on ws://127.0.0.1:9229/2ee5da2d-c15b-416a-9efc-a19bb1299f35 W20190218-21:08:48.040(1)? (STDERR) For help see https://nodejs.org/en/docs/inspector W20190218-21:08:49.291(1)? (STDERR) Debugger attached.
现在通过http://myserver:24000/
在另一个选项卡或浏览器窗口中打开您的应用程序并使用它直到服务器端代码上的debugger
断点被触发并观察检查器选项卡切换到调试模式(您可能已经从客户端调试中了解到)。
我找到了问题,我没有在--inspect
参数中添加主机。现在它的工作是添加--inspect=0.0.0.0:9229