Visual Studio Code 内置了一些很棒的调试功能,可以轻松使用 Node.js 调试应用程序。但是,我的应用程序配置为使用 PM2 版本 3.4.1。节点版本 6.17.1
如何设置 Visual Studio Code 来使用 PM2 进行调试?
vs code 有一个名为“Attach”的调试选项,它允许您附加到正在运行的 Node.js 程序,
示例配置是
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229
}
现在您需要启动 Node.js 程序,如下所示
$ pm2 start "My App" --node-args="--inspect-brk" --watch
vs 代码文档:https://code.visualstudio.com/docs/editor/debugging#_launch-versus-attach-configurations https://code.visualstudio.com/docs/editor/debugging#_launch-versus-attach-configurations
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)