是否可以调试正在运行的生产节点应用程序? [英] Is it possible to debug a currently running production Node application?

查看:110
本文介绍了是否可以调试正在运行的生产节点应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本地我通过运行节点--debug 并使用节点检查器工具进行调试。节点检查器必须在后台运行,然后我将浏览器(并不是所有的浏览器都可以正常工作; Chrome浏览器)指向 http://127.0.0.1:8080/debug?port=5858 调试。

Locally I debug by running node --debug and using the node-inspector tool. node-inspector must be running in the background, then I point my browser (not all browsers work; Chrome does) to http://127.0.0.1:8080/debug?port=5858 to debug.

问题是我无法在本地运行生产服务器(缺少不属于开发机器的私钥文件),使其成为很难调试某些生产问题,即使我愿意在生产机器上闯入。是否可以使用Node检查器?

Problem is I can't run a production server locally (missing private key files that don't belong on a dev machine), making it very hard to debug certain production problems, even if I'm willing to hack on a production machine. Is this still possible with Node inspector?

推荐答案

是的,您只需要从节点检查员的README


  1. node-inspector必须在正在尝试调试的节点进程的机器上运行。因此,您必须能够在这里安装。

  2. 大概您的制作过程不是以 - debug 标志开始。您可以发送一个信号来实现: kill -s USR1< pid> 。 (pid可以用$ code> ps aux | grep node 获得)。

  3. 确保端口8080暴露给本地机器您的生产机器。

  4. 正常浏览浏览器;你都设置好了。

  1. node-inspector has to be running on the machine with the node process you are trying to debug. So, you must be able to install this there.
  2. Presumably your production process did not start with the --debug flag. You can send a signal to achieve this though: kill -s USR1 <pid>. (pid can be obtained with something like ps aux | grep node.)
  3. Make sure port 8080 is exposed to your local machine from your production machine.
  4. Point your browser as normal; you're all set up.

这篇关于是否可以调试正在运行的生产节点应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆