节点检查器未启动

Node-Inspector not starting

首先,我在安装 node-inspector 时遇到问题,我不得不恢复安装版本 @0.7.5.. 全局安装在我的机器上,但现在当我尝试 运行 node-inspector 我收到以下错误。关于这两个错误,我找不到太多信息,我觉得很奇怪。

module.js:487
    throw err;
    ^
Error: Cannot find module '_debugger'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/node-inspector/lib/debugger.js:2:16)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

我今天遇到了同样的问题。经过一番谷歌搜索后,我发现现在已弃用。改用这个:

node --inspect-brk yourScript.js

前往 Official 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): https://chrome.google.com/webstore/detail/nim-node-inspector-manage/gnhhdgbaldcilmgcpfddgdbkhjohddkj

希望对您有所帮助!

这个生态系统发展迅速。现在命令是...

node inspect yourScript.js

https://nodejs.org/dist/latest-v8.x/docs/api/debugger.html