Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot open Chrome to the right url for debugging Node.js script

I run this at the command line:

$ node --inspect --debug-brk  test/src/dev/node/define/1.test.js
Debugger listening on ws://127.0.0.1:9229/93a5524a-ae0a-4aa2-a985-3cd6ac6a2b9f
For help see https://nodejs.org/en/docs/inspector

normally this commands spits out a url that I copy and paste to the browser. At some point it also auto-opened Chrome to the right url so I could start debugging immediately which was very nice. But now it doesn't log the url to open, nor does it auto-open the url! Damn.

Note that the following url is not the right one to open:

ws://127.0.0.1:9229/93a5524a-ae0a-4aa2-a985-3cd6ac6a2b9f

Anybody seen this with Node.js versions 6+?

like image 922
Alexander Mills Avatar asked Nov 20 '17 09:11

Alexander Mills


2 Answers

I don't know why the url is no longer being printed in the console, that's a mystery, but if you look at the docs:

https://nodejs.org/en/docs/inspector/#chrome-devtools-55

it says:

Chrome DevTools 55+

Option 1: Open chrome://inspect in a Chromium-based browser. Click the Configure button and ensure your target host and port are listed. Then select your Node.js app from the list.

Option 2: Install the Chrome Extension NIM (Node Inspector Manager): https://chrome.google.com/webstore/detail/nim-node-inspector-manage/gnhhdgbaldcilmgcpfddgdbkhjohddkj

I think one of these options will work for users that face the issue in the OP. Both are working for me. Using NIM, I switched it to auto-open and it started auto-opening again for me, which is great, not sure why it was ever turned off.

like image 156
Alexander Mills Avatar answered Nov 15 '22 01:11

Alexander Mills


I am using the following link to see all remotely connected debuggers: chrome://inspect/#devices

Run the debugger, open the above link in chrome and you should see there a link to connected debugger

like image 38
sergiy.dragunov Avatar answered Nov 15 '22 00:11

sergiy.dragunov