如何在Chrome中使用Node 8检查器? [英] How to use Node 8 inspector with Chrome?
问题描述
由于节点7或其他原因,我熟悉使用-inspect
选项。现在在节点8上,它不起作用。今天,我要求节点照常使用检查器:
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
它会这样回应:
Debugger listening on ws://127.0.0.1:9229/97a6264d-a751-4467-ac36-172ff3ebaac1
For help see https://nodejs.org/en/docs/inspector
如果我尝试打开该链接, Chrome说:
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
以前曾经是 chrome-devtools://链接,
Before it used to be a "chrome-devtools://" link, which worked splendidly.
有什么用?
在搜索中,我找不到应该的东西与此 ws://
链接有关。
Searching around, I can't find anything I'm supposed to do with this ws://
link.
推荐答案
有信息来自nodejs文档
There is information from nodejs docs
选项1:在基于Chromium的浏览器中打开
chrome:// inspect
。单击
配置按钮,并确保列出了目标主机和端口。
然后从列表中选择您的Node.js应用。
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.
选项2:安装
Chrome扩展程序 NIM(节点检查器管理器)
我更喜欢选项2。
也已弃用-debug-brk
。 Node.js 8.x使用-inspect-brk
Also --debug-brk
is deprecated. Node.js 8.x uses --inspect-brk
这篇关于如何在Chrome中使用Node 8检查器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!