I am familiar with using the --inspect
option since node 7 or something. Now on node 8, it's just not working. Today I asked node to use the inspector, as usual:
$ node --inspect --debug-brk node_modules/mocha/bin/_mocha o/**/*.test.js
It responds with this:
Debugger listening on ws://127.0.0.1:9229/97a6264d-a751-4467-ac36-172ff3ebaac1
For help see https://nodejs.org/en/docs/inspector
If I try to open that link, Chrome says:
This site can’t be reached
The webpage at ws://127.0.0.1:9229/97a6264d-a751-4467-ac36-172ff3ebaac1 might be temporarily down or it may have moved permanently to a new web address.
ERR_DISALLOWED_URL_SCHEME
Before it used to be a "chrome-devtools://" link, which worked splendidly.
What gives?
Searching around, I can't find anything I'm supposed to do with this ws://
link.
Using Google Chrome DevTools to Debug The next step is to head to Chrome, open a new tab, and enter the URL chrome://inspect/ . Click on “Open dedicated DevTools for Node” to start debugging the application. It will take a couple of seconds to view the source code in Chrome DevTools.
V8 Inspector can be enabled by passing the --inspect flag when starting a Node. js application. It is also possible to supply a custom port with that flag, e.g. --inspect=9222 will accept DevTools connections on port 9222.
Despite some of the similarities a Google Chrome Extension and Nodejs have nothing to with each other. You cannot use them together in some special way outside of the normal client/server communication.
There is information from nodejs docs
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)
I prefer option 2.
Also --debug-brk
is deprecated. Node.js 8.x uses --inspect-brk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With