简体   繁体   中英

How to use Node 8 inspector with Chrome?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM