How do you debug a Node.js server running with Chrome/WebKit as the remote debugger?

后端 未结 4 1554
清歌不尽
清歌不尽 2021-02-01 06:21

If you have your Node running

node --debug server.js

This gives me a port number xxxx, should I use this port number when starting Chrome?

4条回答
  •  青春惊慌失措
    2021-02-01 06:51

    • using $ vagrant ssh -- -L 5858:127.0.0.1:5858

        to ssh connect to VM. also this comment would start a proxy server on port 5858;
      
    • you could test using telnet 127.0.0.1 5858 to see if local proxy server started or not.

    • In VM, you can start node with command

    • $ node --debug-brk app.js

    • set up debug configuration in web storm.
    • when you start debug in web storm, node.js server in VM will start in a few seconds.

    PS: there is no need to touch the vagrant file. Reference: Connecting WebStorm to a remote node.js debugging session.

提交回复
热议问题