问题描述
本地我通过运行节点--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?
推荐答案
是的,您只需要从:
- node-inspector必须在正在尝试调试的节点进程的机器上运行。因此,您必须能够在这里安装。
- 大概您的制作过程不是以
- debug
标志开始。您可以发送一个信号来实现:kill -s USR1< pid>
。 (pid可以用$ code> ps aux | grep node 获得)。 - 确保端口8080暴露给本地机器您的生产机器。
- 正常浏览浏览器;你都设置好了。
- 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.
- 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 likeps aux | grep node
.) - Make sure port 8080 is exposed to your local machine from your production machine.
- Point your browser as normal; you're all set up.
这篇关于是否可以调试正在运行的生产节点应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!