使用intellij远程debugging节点js服务器

看了很多关于远程节点js服务器的debugging的post,并尝试了很多他们的解决scheme,但没有设法使我的configuration工作

我已经在Windows PC上安装了Intellij,并使用以下“Node.js远程debugging”configuration:主机:my-server.dev.com端口:5858

节点服务器本身安装在UBUNTU上,定义了以下端口转发规则:socat TCP-LISTEN:5858,fork TCP:localhost:6000

并使用以下命令运行服务器(cluster:/usr/local/n/versions/node/0.10.44/bin/node –debug = 6000 /opt/play/play-server/main.js)

Intellij将会话显示为已连接,但不能在断点上断开

解决这个问题有几个步骤:1.启动脚本执行程序来使用:“n use 0.10.44 –debug”
//(这是从我的脚本)

forever \ --pidFile $PIDFILE \ -a \ -l $LOGFILE \ --minUptime $MIN_UPTIME \ --spinSleepTime $SPIN_SLEEP_TIME \ start -c "n use 0.10.44 --debug" $APPLICATION_PATH 2>&1 > /dev/null & RETVAL=$? 
  1. 在远程集群上创build一个转发规则(这里是端口6000)socat TCP-LISTEN:5858,fork TCP:localhost:6000
  2. 在你的fork节点服务器中:

    var debug = process.execArgv.indexOf(' – debug')!== -1; 如果(debugging){//设置一个未使用的端口号。 process.execArgv.push(' – debug ='+(6000)); } var childProcess = cluster.fork();

这使我可以使用我在问题中设置的相同intellijconfiguration只debugging其中一个群集进程