这是我第一次尝试用调试器工具来设置Nodejs。我的lauch.json代码是:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/app.js"
},
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}"
}
]
}当我在VS代码中运行调试器并转到调试控制台时。我得到:
C:\ Files\nodejs\node.exe程序--检查-brk=29182 app.js 在ws://127.0.0.1:29182/c2a39cf7-ab13-4sd1b-afs5-eb9wqwq5de9上侦听调试器
我也在我的app.js上设置了一个断点。
我试过去
ws://127.0.0.1:29182/c2a39cf7-ab13-4sd1b-afs5-eb9wqwq5de9url,如调试器中所示,但它提供了:
无法到达站点
铬误差
发布于 2019-03-08 04:37:40
不,这是调试器侦听的端口,您不应该进入该路径,您将进入您的nodejs服务器正在侦听的端口,调试器将侦听该端口。
例如:我有一个节点服务器运行在端口3000上,我有一个get请求,如下所示
app.get('/',()=>{
console.log("This is get request");
})我在这条线上有一个断点:console.log("This is get request");。我将通过运行调试器启动服务器。
然后我会去localhost:3000从邮递员检查和调试器将自动调用。
https://stackoverflow.com/questions/55056546
复制相似问题