VSCode中远程调试NodeJS配置
Posted by:  | Word Count: 147   | Reading Time: 1 Minute  
  1. 进入远程服务器通过以下命令启动待调试的NodeJS应用

     node --inspect=0.0.0.0 <启动应用程序.js>
    
  2. 进入VSCode项目根目录,打开 .vscode/launch.jsonconfigurations 中增加以下配置:1

         {
     "type": "node",
     "request": "attach",
     "name": "Node Remote Debug",
     "address": "远程服务器地址",
     "port": 9229, #
     "localRoot": "${workspaceFolder}",
     "remoteRoot": "远程服务器上执行脚本的根目录"
     }
    

Footnote:


  1. NodeJS调试指南 ↩︎