节点检查器无法启动

node-inspector failing to start

命令运行:

$ node-debug --web-port=8090 myfile.js

返回如下:

Node Inspector is now available from http://127.0.0.1:8090/debug?port=5858 Debugging myfile.js

debugger listening on port 5858 Command failed: [971:971:0223/200200:ERROR:browser_main_loop.cc(210)] Gtk: cannot open display: :0 Error: cannot open display: :0 /usr/bin/xdg-open: 461: /usr/bin/xdg-open: mozilla: not found /usr/bin/xdg-open: 461: /usr/bin/xdg-open: epiphany: not found /usr/bin/xdg-open: 461: /usr/bin/xdg-open: konqueror: not found /usr/bin/xdg-open: 461: /usr/bin/xdg-open: chromium-browser: not found [1005:1005:0223/200201:ERROR:browser_main_loop.cc(210)] Gtk: cannot open display: :0 /usr/bin/xdg-open: 461: /usr/bin/xdg-open: links2: not found /usr/bin/xdg-open: 461: /usr/bin/xdg-open: links: not found /usr/bin/xdg-open: 461: /usr/bin/xdg-open: lynx: not found /usr/bin/xdg-open: 461: /usr/bin/xdg-open: w3m: not found xdg-open: no method available for opening 'http://127.0.0.1:8090/debug?port=5858' Please open the URL manually in Chrome/Chromium/Opera or similar browser

访问http://127.0.0.1:8090/debug?port=5858,然而,returns,"Connection Refused"错误。

您可以添加 -c 选项来防止 node-debug 打开浏览器:

$ node-debug -c --web-port 8090 myfile.js

IIRC node-debug 丢弃来自检查器后端的错误消息。您可以尝试手动 运行 后端来验证它是否正确启动。

$ node-inspector --web-port 8090
# in another terminal tab/window
$ node --debug myfile.js