gpt4 book ai didi

javascript - 调试 Express JS 应用程序 Visual Studio 代码 :

转载 作者:太空宇宙 更新时间:2023-11-04 01:55:18 24 4
gpt4 key购买 nike

我正在尝试通过 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com