[英]Node-inspector with Express 4
I am trying to run node-inspector with an Express 4 App -- I am running this in a Vagrant box but am able to view the pages in the browser without any problems (I have the ports on the vagrant machine available to the host machine). 我正在尝试使用Express 4应用程序运行node-inspector - 我在Vagrant框中运行它但是能够在浏览器中查看页面而没有任何问题(我在主机上可以使用vagrant机器上的端口)。
I fire up the application either with npm start
or node --debug bin/www
and then start the node-debugger bin/www
. 我使用
npm start
或node --debug bin/www
npm start
应用程序,然后启动node-debugger bin/www
。 I load the inspector in the browser and it hits the initial breakpoint on the first line but performing any action on the page to debug that would trigger a breakpoint causes an EADDRINUSE
(aka the port is in use) error. 我在浏览器中加载了检查器并且它在第一行上遇到了初始断点,但是在页面上执行任何操作以调试会触发断点导致
EADDRINUSE
(也就是端口正在使用中)错误。 I'm a little baffled as to what could be causing this, however, it's very possible I'm using commands that would work on Express 3 instead of 4. Additionally, maybe there is some configuration I am missing to run the debugger on the browser of the host-machine but running inspector on the vagrant box? 关于可能导致这种情况的原因,我有点困惑,但是,我很可能使用可以在Express 3而不是4上运行的命令。另外,也许有一些配置我缺少在运行调试器上主机的浏览器,但在流浪盒上运行检查员?
Update : I'm pretty sure this is your problem: 更新 :我很确定这是你的问题:
node --debug bin/www and then start the node-debugger bin/www.
node --debug bin / www然后启动node-debugger bin / www。
Don't do BOTH of those. 不要做两个 。 It's one or the other.
这是一个或另一个。 They are 2 ways of doing the same thing.
他们是做同样事情的两种方式。 I prefer the former way as it's simpler and works with node itself whether or not you are using node-inspector.
我更喜欢前一种方式,因为它更简单,无论您是否使用节点检查器,它都可以与节点本身一起使用。
To summarize: 总结一下:
node-debug bin/www
starts both your app in debug mode AND node-inspector in the same process node-debug bin/www
在同一进程中启动调试模式和节点检查器中的应用程序 node --debug bin/www
starts your app in debug mode. node --debug bin/www
以调试模式启动您的应用程序。 This should be combined with a separate terminal window where you run node-inspector
as a separate process. node-inspector
作为单独的进程运行。 I recommend this approach, but either should work. Here's my suggestion to start troubleshooting this. 这是我的建议,开始对此进行故障排除。 Try to use the simplest form of the commands to get everything running:
尝试使用最简单的命令形式来运行一切:
node --debug ./bin/www
node --debug ./bin/www
直接在前台启动您的应用程序
sudo netstat -ntlp
to see which process it is, comprehend what it is and why it is running, and then kill it to free up the port kill <pid-you-got-from-netstat>
sudo netstat -ntlp
来查看它是什么进程,理解它是什么以及它为什么运行,然后杀死它以释放端口kill <pid-you-got-from-netstat>
node-inspector
in the foreground. node-inspector
。 Make sure you see the normal output and no errors. http://localhost:8080/debug?port=5858
(unless your vagrant IP/port are different) http://localhost:8080/debug?port=5858
(除非您的流浪者IP /端口不同) EADDRINUSE
error you see. EADDRINUSE
错误的一些确切细节,你会看到。 Is that an exception within your app itself? 同样的过程适用于主管。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.