简体   繁体   English

调试Express js应用程序Visual Studio代码:

[英]debug express js application visual studio code:

I am trying to debug my express js application through visual studio code here is my launch.json 我正在尝试通过Visual Studio代码调试我的Express JS应用程序,这是我的launch.json

{
    "version": "0.2.0",
    "configurations": [

        {
            "type": "node",
            "request": "attach",
            "name": "Attach",
            "port": 9229
        }
    ],
    "compounds": []
}

And my application is running in port 3000 but when i run debugger i got the following error 我的应用程序在端口3000中运行,但是当我运行调试器时,出现以下错误

Debugging with legacy protocol because Node.js version could not be determined (Error: connect ECONNREFUSED 127.0.0.1:9229) 使用传统协议进行调试,因为无法确定Node.js版本(错误:连接ECONNREFUSED 127.0.0.1:9229)

You can change request as launch,add protocol as inspector in your file and put your main server file in program, here my server file called as server.js. 您可以将请求更改为启动,将协议添加为检查器,然后将主服务器文件放入程序中,这里我的服务器文件称为server.js。

 {
   "version": "0.2.0",
   "configurations": [
      {
         "type": "node",
         "request": "launch",
         "name": "Launch Program",
         "protocol": "inspector",
         "program": "${workspaceFolder}/server.js"
      }
   ]
}

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

相关问题 如何通过附加到正在运行的进程来使用Visual Studio Code在Node上调试Express js服务器代码 - How to debug Express js server code on Node using Visual Studio Code by Attaching to running process Visual Studio Code 中调试控制台中的 Node.js readline - Node.js readline in debug-console in Visual Studio Code Visual Studio代码无法找到调试节点js的程序 - visual studio code cannot find a program to debug node js 如何在Visual Studio Code中调试单个Nightwatch JS测试 - How to debug a single Nightwatch JS test in Visual Studio Code 如何使用 Visual Studio Code 调试 PHP 页面中的 JS? - How to debug JS in PHP page with Visual Studio Code? 在 Visual Studio 代码中调试不起作用 - Debug in visual studio code is not working 如何在不转译代码的情况下在 Visual Studio Code 中使用 ES6 模块调试 Node.JS? - How to debug Node.JS with ES6 modules in Visual Studio Code without transpiling the code? 如何使用Visual Studio 2013和Node Tools NTVS调试node.js应用程序 - How to debug node.js application with Visual Studio 2013 and Node Tools NTVS 在Visual Studio 2010中调试Java脚本代码 - Debug Java Script code in Visual Studio 2010 使用 Visual Studio Code 调试 Chrome 扩展 - Debug Chrome Extensions with Visual Studio Code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM