Node.js:如何附加到正在运行的进程并使用控制台调试服务器? [英] Node.js: How to attach to a running process and to debug the server with a console?
本文介绍了Node.js:如何附加到正在运行的进程并使用控制台调试服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用永远"来运行我的应用程序.我想附加到运行环境中以检查我的应用程序.那我该怎么办?
I use 'forever' to run my application. I want to attach to the running environment to inspect my application. So what can I do?
推荐答案
来自 http://nodejs.org /api/debugger.html :
高级用法
可以通过使用--debug命令行标志启动Node或通过发出信号来启用和访问V8调试器. SIGUSR1的现有Node进程.
Advanced Usage
The V8 debugger can be enabled and accessed either by starting Node with the --debug command-line flag or by signaling an existing Node process with SIGUSR1.
找到您的node
进程的PID,然后发送SIGUSR1
应该可以解决问题:
Find the PID of your node
process and then sending SIGUSR1
should do the trick:
kill -s SIGUSR1 nodejs-pid
然后运行node-inspector
并浏览至其指示的URL. 本教程中的更多内容.
Then run node-inspector
and browse to the URL it indicates. More in this tutorial.
这篇关于Node.js:如何附加到正在运行的进程并使用控制台调试服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文