nodeinspector之配置启动

node-inspector之配置启动

  node-inspector是个网页nodejs debug 工具,非常不错。

  • 使用npm安装node-inspector (sudo npm install node-inspector)
  • 启动node-inspector (node-inspector &)
  • 通过--debug执行nodejs (node --debug example.js)
  • 在chrome中输入http://127.0.0.1:8080,打开的tab我们称其为debug tab (firefox不支持)
  • 在Scripts里面找到你的nodejs程序,设置断点(这个和在eclipse设置断点相同,点击行最左侧位置即可)
  • 在chrome里打开另外一个tab,然后输入http:127.0.0.1:8234, 这个tab我们称其为trigger tab(注意要开启新的tab,上面那个地址打开的tab就留着,另外这里输入的端口是你自己程序中listen的端口,要改成自己的port)
  • 在debug tab中我们就可以开始单步执行程序、查看各种变量、添加你想监控的变量,堆栈信息等等
  • debug结束以后,我们能在trigger tab中看到最后的输出结果

  node-inspector配上一款ide,效果应该会不错。

原文地址:https://www.cnblogs.com/tekkaman/p/2880183.html