我正在像这样在远程服务器(my-domain.com)上运行Express应用程序:

node --inspect=0.0.0.0:9229 ./server.js


intellij idea中,我设置了debug configuration (Attach Node.js/chrome)

host: my-domain.com
port: 9229


当我单击debug按钮时,出现此错误:


  来自远程主机的无效响应。请检查
  调试配置




我可以使用以下设置在本地主机上调试相同的应用程序:

host: localhost
port: 9229


为什么我无法附加到远程节点应用程序并对其进行调试? intellij idea可以给我更多有关错误的信息吗?

最佳答案

我找到了解决我和许多其他问题的好方法,它已经存在了很长时间了,我不使用它! :)

对于我的特殊问题,可以使用ssh tunnels

ssh -L 9221:localhost:9229 user@my-domain.com


现在,我可以将节点调试器附加到本地主机:9221。它将所有流量从远程端口9229转发到我的本地9221。

另一个是远程端口转发:

刚刚在/etc/ssh/sshd_config中添加了这一行:

GatewayPorts yes


这是

ssh -R 9001:localhost:9000 user@my-domain.com


现在,发送到我的本地节点的远程计算机上的端口9000上的所有流量均表示应用程序。我可以调试,做我想做的

这是我从中得到想法的文章:https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html

07-25 22:43
查看更多