如何使用 PHPStorm 远程调试 Node JS?

2024-01-19

我有一个 Windows 盒子和一个运行 CentOS 的虚拟机。有谁知道如何使用 PHPStorm 调试节点 CLI 脚本(不打开端口)? “编辑配置”似乎只支持连接某处而不是侦听传入连接。


确保您拥有节点插件 http://www.jetbrains.com/ruby/webhelp/run-debug-configuration-node-js-remote-debug.html安装。

如果您的服务器有可用的平衡器包(我的 EC2 盒子没有),您可以使用本教程 http://www.binarysludge.com/2012/02/21/phpstorm-remote-debugging-node-js-on-a-foreign-host-jetbrains-webstorm-rubymine/使用平衡器转发端口。

yum install balance -yt
balance -df 8585 127.0.0.1.5858

许多人报告成功将 iptables 从 eth0 重定向到 lo(对我来说不起作用),如下所示:

iptables -t nat -A PREROUTING -p tcp -m tcp -i eth0 --dport 5858 -j DNAT --to 127.0.0.1:5858

还有一个简单的节点脚本在此 eclipse 调试 tut 中描述 https://github.com/joyent/node/wiki/using-eclipse-as-node-applications-debugger(靠近底部),这会将本地调试隧道传输到远程主机。

But once I was that far down the path, I didn't see the point as I'm familiar with SSH. So ultimately, I went with an SSH tunnel http://oldsite.precedence.co.uk/nc/putty.html and set up PHPStorm to debug localhost. SSH Tunnel using putty

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用 PHPStorm 远程调试 Node JS? 的相关文章

随机推荐