VS Code 远程调试到集群中的 NodeJs

Mic*_*jas 8 node.js visual-studio-code vscode-debugger vscode-remote

我正在尝试远程调试使用clusters 的NodeJs 应用程序。当我在本地运行我的应用程序并附加到它时,VS Code 会看到子进程和断点工作:

在此处输入图片说明

VS 代码配置:

{
  "name": "Attach",
  "type": "node",
  "request": "attach",
  "port": 50131,
  "internalConsoleOptions": "neverOpen",
  "skipFiles": ["<node_internals>/**"],
  "autoAttachChildProcesses": true
},
Run Code Online (Sandbox Code Playgroud)

VS 代码结果:

在此处输入图片说明

但是,在远程主机中,进程以相同的方式启动,相同的端口,我可以将调试器附加到它,但是 VS Code 看不到子进程和源映射(将本地文件断点连接到远程,在调试配置中我有正确的主机地址):

在此处输入图片说明

所以本地 env 和远程之间的区别是 Windows 与 Unix,并且在远程应用程序中是通过 Forever 运行的(但是,即使是 Forever 模块,没有集群远程调试工作正常)。

哪里会出问题?

编辑:我无法在我的组织中使用 SSH 调试。

Avi*_* Lo 3

尝试一下vscode 扩展Remote SSH。它允许您在本地运行远程代码。

https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh