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


  • port <number> 监听检查器连接的端口。 可选的。 默认值: 命令行上指定的内容。
  • host <string> 主机监听检查器连接。 可选的。 默认值: 命令行上指定的内容。
  • wait <boolean> 在客户端连接之前阻塞。 可选的。 默认值: false

在主机和端口上激活检查器。 相当于 node --inspect=[[host:]port],但可以在 node 启动后以编程方式完成。

如果等待为 true,则将阻塞直到客户端连接到检查端口并且流量控制已传给调试器客户端。

  • port <number> Port to listen on for inspector connections. Optional. Default: what was specified on the CLI.
  • host <string> Host to listen on for inspector connections. Optional. Default: what was specified on the CLI.
  • wait <boolean> Block until a client has connected. Optional. Default: false.

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

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.

See the security warning regarding the host parameter usage.