node.js - 使用 PM2 和 Vscode 进行调试
问题描述
Visual Studio 代码内置了一些很棒的调试功能,可以很容易地使用 node.js 调试应用程序。但是,我的应用程序配置为使用 PM2 版本 3.4.1。节点版本 6.17.1 如何设置 Visual Studio Code 以使用 PM2 进行调试?
解决方案
Vs code has a debugging option called “Attach” which allows you to attach to a running Node.js program, A sample configuration would be
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229
}
Now you need to start your Node.js program like below
$ pm2 start "My App" --node-args="--inspect-brk" --watch
vs code docs : https://code.visualstudio.com/docs/editor/debugging#_launch-versus-attach-configurations
推荐阅读
- php - 在php中提交带有循环和变量的数组
- asp.net - 从代码后面添加onclick代码格式化吗?
- java - 有没有更好的方法用 Java Prepared 语句编写 SQL Insert 语句
- python - 我想创建一个文件夹,它只包含 1 个视频文件。现在我希望 os.walk 访问该文件并将其分配给 cv2.VideoCapture
- react-native - 如何在 React Native 中使用 App.js 文件中的导航道具
- html - 通过css在HTML列表上的圆角
- wordpress - 在产品价格前添加文字应该只影响某些产品
- node.js - Sequelize hasMany 和 belongsTo 在同一个关联中
- javascript - 在 html 文件中打印 exim 邮件队列
- typescript - Typescript:如何将类型的属性过滤为特定类型的属性?