[英]How to debug Express js server code on Node using Visual Studio Code by Attaching to running process
I have: 我有:
This is my Attach configuration: 这是我的附加配置:
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
"configurations": [
{
"name": "Attach",
"request": "attach",
"type": "node",
// // TCP/IP address. Default is "localhost".
// //"address": "localhost",
// // // Port to attach to.
"port": 5858
}
]
}
This is the gulp task starting the application: 这是启动应用程序的gulp任务:
gulp.task('server', function (cb) {
exec('mongod', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
exec('node server.js', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
})
And this is the result of running Attach 这是运行Attach的结果
request 'attach': cannot connect to runtime process (timeout after 10000ms)
What I'm doing wrong and why? 我在做什么错,为什么? How can I attach Visual Studio Code debugger to running Node app and debug server.js? 如何将Visual Studio Code调试器附加到正在运行的Node app并调试server.js?
You will see this timeout error if the server isn't running when you try to attach the debugger. 如果在尝试附加调试器时服务器未运行,则会看到此超时错误。 The client starts the language server so make sure you have started the client in order to have a running server. 客户端启动语言服务器,因此请确保已启动客户端,以使服务器运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.