纯nodejs的后台代码(即,不通过浏览器运行,仅跑在命令行上的nodejs程序),可以通过vscode的debug功能,进行单步调试

如上图,依次点击 debug => Add Configuration => 选择 Node.js: Launch Program
然后,将自动生成的配置的 name 改成自己想要的名字,program 改成自己想调试的js文件,我这个项目是想调试 check_flow.js,我改成下面这样。
{
// 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": "Check Flow",
"program": "${workspaceFolder}/check_flow.js"
}]
}
然后,就可在VS中 先选中 Check Flow ,点击 绿色三角 启动单步了。

网友评论