Search code examples
node.jsubuntuubuntu-12.04node-inspector

node-inspector failing to start


Command ran:

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

This returned following:

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

Visiting http://127.0.0.1:8090/debug?port=5858, however, returns, "Connection Refused" error.


Solution

  • You can add -c option to prevent node-debug from opening the browser:

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

    IIRC node-debug discards error messages from inspector backend. You can try to run the backend manually to verify that it starts correctly.

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