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

  • 相关阅读:
    python-获取网页源码及保存网页图片到本地实例
    python-随机向文件中写入100个名字实例
    python-计算文件中每个字出现的次数
    python-序列类型
    python-字符串
    python示例1(基本知识巩固)
    python-示例(基本知识巩固)
    [leetcode] Binary Tree Upside Down
    Trie 树
    第K大问题
  • 原文地址:https://www.cnblogs.com/testzcy/p/14728260.html
Copyright © 2011-2022 走看看