简体   繁体   English

VScode调试器在调试远程节点服务器时不会在断点上停止

[英]VScode debugger not stopping on breakpoints while debugging a remote node server

I'm trying to debug my remote node server through VSCode and it doesn't stop on any of the breakpoints i've configured. 我正在尝试通过VSCode调试我的远程节点服务器,并且它不会在我配置的任何断点上停止。

I'm running VSCode on my mac where i have one copy of the node project and i have another copy of the same node project on a remote machine, both copies of the node project are synced. 我在Mac上运行VSCode,其中我有一个节点项目的副本,而我在远程计算机上有相同节点项目的另一个副本,该节点项目的两个副本都已同步。

i'm running the node server on the remote machine using the following command: 我正在使用以下命令在远程计算机上运行节点服务器:

sudo node --inspect=5858 app.js

and my VSCode launch.json configurations are as follow: 和我的VSCode launch.json配置如下:

{   
    "name": "Attach",
    "type": "node",
    "request": "attach",
    "port": 5858,
    "address": "remote server addr",
    "localRoot": "${workspaceFolder}",
    "remoteRoot": "the path to project directory on remote server",
    "protocol": "auto"
}

When i launch the debugger on VSCode it seems like it connects to the remote server but it doesn't stop at any of my breakpoints. 当我在VSCode上启动调试器时,似乎它已连接到远程服务器,但它并没有在我的任何断点处停止。

VSCode version is 1.28.1 VSCode版本为1.28.1

Node version is 9.11.2 节点版本为9.11.2

What am i missing? 我想念什么?

I found the solution to my question the configuration i was missing is server=4771 我找到了我缺少的配置的问题的解决方案是server = 4771

when i run my app as follow: 当我按以下方式运行我的应用程序时:

sudo node --inspect=5858 app.js server=4771

VSCode debugger is able to debug my remote node server, more details about it are mentioned here: https://code.visualstudio.com/docs/extensions/example-debuggers VSCode调试器能够调试我的远程节点服务器,有关此方面的更多详细信息,请参见此处: https ://code.visualstudio.com/docs/extensions/example-debuggers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM