inspector.open([port[, host[, wait]]])


  • port <number> 用于监听调试器连接的端口。可选。 默认值: 命令行中指定的值。
  • host <string> 用于监听调试器连接的主机。可选。 默认值: 命令行中指定的值。
  • wait <boolean> 阻塞直到客户端连接。可选。 默认值: false
  • 返回值: <Disposable> 一个 Disposable,会调用 inspector.close()

在主机和端口上激活调试器。等同于 node --inspect=[[host:]port],但可以在 Node 启动后通过编程方式完成。

【Activate inspector on host and port. Equivalent to node --inspect=[[host:]port], but can be done programmatically after node has started.】

如果 wait 为 true,将阻塞直到有客户端连接到调试端口并且流量控制已传递给调试客户端。

【If wait is true, will block until a client has connected to the inspect port and flow control has been passed to the debugger client.】

请参阅 安全警告 关于 host 参数的使用。

【See the security warning regarding the host parameter usage.】