我正在尝试通过 Visual Studio 代码调试我的 Express JS 应用程序 这是我的 launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229
}
],
"compounds": []
}
我的应用程序正在端口 3000 中运行,但是当我运行调试器时,出现以下错误
Debugging with legacy protocol because Node.js version could not be determined (Error: connect ECONNREFUSED 127.0.0.1:9229)
最佳答案
您可以将请求更改为启动,将协议(protocol)添加为文件中的检查器,并将主服务器文件放入程序中,这里我的服务器文件名为 server.js。
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"protocol": "inspector",
"program": "${workspaceFolder}/server.js"
}
]
}
关于javascript - 调试 Express JS 应用程序 Visual Studio 代码 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48203405/