zoukankan      html  css  js  c++  java
  • 使用Chrome浏览器调试nodejs代码 转载:https://blog.csdn.net/zhouzying/article/details/98960721

    今天给大家分享一下在chrome浏览器上调试nodejs代码的步骤。下面是操作:

    第一步,在命令行输入调试命令:
    node --inspect-brk app.js
    这是调试命令的一些参数(来自官网的):

    Command-line options
    The following table lists the impact of various runtime flags on debugging:

    Flag Meaning
    --inspect
    Enable inspector agent
    Listen on default address and port (127.0.0.1:9229)
    --inspect=[host:port]
    Enable inspector agent
    Bind to address or hostname host (default: 127.0.0.1)
    Listen on port port (default: 9229)
    --inspect-brk
    Enable inspector agent
    Listen on default address and port (127.0.0.1:9229)
    Break before user code starts
    --inspect-brk=[host:port]
    Enable inspector agent
    Bind to address or hostname host (default: 127.0.0.1)
    Listen on port port (default: 9229)
    Break before user code starts
    node inspectscript.js
    Spawn child process to run user's script under --inspect flag; and use main process to run CLI debugger.
    node inspect --port=xxxx script.js
    Spawn child process to run user's script under --inspect flag; and use main process to run CLI debugger.
    Listen on port port (default: 9229)
    --inspect-brk参数后面也能指定端口,未指定就使用默认的9229端口。

    第二步,打开chrome开始调试:
    1.在地址栏中输入:chrome://inspect

    2.出现如下图所示的情况:

     这时候点击, 绿色字体那块,open dedicated DevTools for node.

    3.于是就会出现调试页面:

    于是我们就可以开始调试node代码了。
    ————————————————
    版权声明:本文为CSDN博主「Jasonzhiying」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/zhouzying/article/details/98960721

  • 相关阅读:
    15年双11手淘前端技术分享(转)
    高程第9章 客户端检测
    高程8.4 screen对象 8.5history对象 8.6小结
    高程8.2location对象 8.3navigator对象
    高程第8章 BOM 8.1window对象
    高程 7.3 模仿块级作用域 7.4私有变量 7.5小结
    高程 第7章函数表达式 7.1递归 7.2闭包
    23、GoAccess分析Nginx日志
    11、Nginx反向代理服务
    10、LNMP架构
  • 原文地址:https://www.cnblogs.com/testzcy/p/14728260.html
Copyright © 2011-2022 走看看