![](/img/trans.png)
[英]How to debug Express js server code on Node using Visual Studio Code by Attaching to running process
[英]debug express js application visual studio code:
我正在尝试通过Visual Studio代码调试我的Express JS应用程序,这是我的launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229
}
],
"compounds": []
}
我的应用程序在端口3000中运行,但是当我运行调试器时,出现以下错误
使用传统协议进行调试,因为无法确定Node.js版本(错误:连接ECONNREFUSED 127.0.0.1:9229)
您可以将请求更改为启动,将协议添加为检查器,然后将主服务器文件放入程序中,这里我的服务器文件称为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.