(window.webpackJsonp=window.webpackJsonp||[]).push([[2249],{2659:function(t,e,r){"use strict";r.r(e);var s=r(31),a=Object(s.a)({},(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[r("h1",{attrs:{id:"remote-debugging-in-node-js"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#remote-debugging-in-node-js"}},[t._v("#")]),t._v(" Remote Debugging in Node.JS")]),t._v(" "),r("h2",{attrs:{id:"nodejs-run-configuration"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#nodejs-run-configuration"}},[t._v("#")]),t._v(" NodeJS run configuration")]),t._v(" "),r("p",[t._v("To set up Node remote debugging, simply run the node process with the "),r("code",[t._v("--debug")]),t._v(" flag. You can add a port on which the debugger should run using "),r("code",[t._v("--debug=")]),t._v(".")]),t._v(" "),r("p",[t._v("When your node process starts up you should see the message")]),t._v(" "),r("div",{staticClass:"language-js extra-class"},[r("pre",{pre:!0,attrs:{class:"language-js"}},[r("code",[t._v("Debugger listening on port "),r("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("port"),r("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n\n")])])]),r("p",[t._v("Which will tell you that everything is good to go.")]),t._v(" "),r("p",[t._v("Then you set up the remote debugging target in your specific IDE.")]),t._v(" "),r("h2",{attrs:{id:"intellij-webstorm-configuration"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#intellij-webstorm-configuration"}},[t._v("#")]),t._v(" IntelliJ/Webstorm Configuration")]),t._v(" "),r("ol",[r("li",[t._v("Make sure that the NodeJS plugin is enabled")]),t._v(" "),r("li",[t._v("Select your run configurations (screen)")])]),t._v(" "),r("p",[r("a",{attrs:{href:"http://i.stack.imgur.com/74hst.png",target:"_blank",rel:"noopener noreferrer"}},[r("img",{attrs:{src:"http://i.stack.imgur.com/74hst.png",alt:"Run configurations"}}),r("OutboundLink")],1)]),t._v(" "),r("ol",[r("li",[t._v("Select "),r("strong",[t._v("+")]),t._v(" > "),r("strong",[t._v("Node.js Remote Debug")])])]),t._v(" "),r("p",[r("a",{attrs:{href:"http://i.stack.imgur.com/MVlrq.png",target:"_blank",rel:"noopener noreferrer"}},[r("img",{attrs:{src:"http://i.stack.imgur.com/MVlrq.png",alt:"Add new configuration"}}),r("OutboundLink")],1)]),t._v(" "),r("ol",[r("li",[t._v("Make sure you enter the port selected above as well as the correct host")])]),t._v(" "),r("p",[r("a",{attrs:{href:"http://i.stack.imgur.com/x7Hbu.png",target:"_blank",rel:"noopener noreferrer"}},[r("img",{attrs:{src:"http://i.stack.imgur.com/x7Hbu.png",alt:"Configure port and host"}}),r("OutboundLink")],1)]),t._v(" "),r("p",[t._v("Once those are configured simply run the debug target as you normally would and it will stop on your breakpoints.")]),t._v(" "),r("h2",{attrs:{id:"use-the-proxy-for-debugging-via-port-on-linux"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#use-the-proxy-for-debugging-via-port-on-linux"}},[t._v("#")]),t._v(" Use the proxy for debugging via port on Linux")]),t._v(" "),r("p",[t._v("If you start your application on Linux, use the proxy for debugging via port, for example:")]),t._v(" "),r("div",{staticClass:"language-js extra-class"},[r("pre",{pre:!0,attrs:{class:"language-js"}},[r("code",[t._v("socat "),r("span",{pre:!0,attrs:{class:"token constant"}},[t._v("TCP")]),r("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),r("span",{pre:!0,attrs:{class:"token constant"}},[t._v("LISTEN")]),r("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),r("span",{pre:!0,attrs:{class:"token number"}},[t._v("9958")]),r("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("fork "),r("span",{pre:!0,attrs:{class:"token constant"}},[t._v("TCP")]),r("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),r("span",{pre:!0,attrs:{class:"token number"}},[t._v("127.0")]),r("span",{pre:!0,attrs:{class:"token number"}},[t._v(".0")]),r("span",{pre:!0,attrs:{class:"token number"}},[t._v(".1")]),r("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),r("span",{pre:!0,attrs:{class:"token number"}},[t._v("5858")]),t._v(" "),r("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),t._v("\n\n")])])]),r("p",[t._v("Use port 9958 for remote debugging then.")])])}),[],!1,null,null,null);e.default=a.exports}}]);