我正在尝试使用node-inspector调试我的nodejs应用程序.但Google Chrome不会显示代码.
我正在使用以下,
Node.js:v0.10.26
快递:4.0.0
节点检查器:v0.7.3
谷歌浏览器版本:34.0.1847.131
这就是我正在做的启动调试器..
$ node-inspector
Node Inspector v0.7.3
Visit http://127.0.0.1:8080/debug?port=5858 to start debugging.
Run Code Online (Sandbox Code Playgroud)
在另一个控制台中
$ node --debug app.js
debugger listening on port 5858
$
Run Code Online (Sandbox Code Playgroud)
然后启动谷歌Chrome并转到
http://127.0.0.1:8080/debug?port=5858
Run Code Online (Sandbox Code Playgroud)
它打开了节点检查器,但没有任何代码.所有窗口都是空的.
注意到我没有得到'快速服务器侦听端口3000'
无法解决我所缺少的问题.很高兴你有任何建议..所以我可以在谷歌浏览器中调试我的Node.js应用程序.
有没有办法使用节点检查器来使用Jest调试单元测试?有时可以逐步查看测试失败的原因
我尝试了几种方法
node-debug jest --runInBand
Run Code Online (Sandbox Code Playgroud)
从以及首先启动检查员,例如
$ node-inspector
$ node --debug-brk .\node_modules\jest-cli --runInBand
Run Code Online (Sandbox Code Playgroud)
然后导航到 http://127.0.0.1:8080/debug?port=5858
我偶尔发现(10次左右),调试器打开jest src文件,可以调试它们.但一般来说,调试器中的脚本只包含"无域"文件夹和另一个不相关的文件夹.此外,测试脚本本身永远不会在调试器中加载.
有人曾尝试过这个吗?
我知道如何使用node-inspector和iisnode调试http应用程序.但是,我可以在Windows上使用node-inspector调试非http节点应用程序吗?
我试过了:
node debug test.js
Run Code Online (Sandbox Code Playgroud)
它说:
debugger listening on port 5858
Run Code Online (Sandbox Code Playgroud)
但http://localhost:5858/在Chrome中打开并没有做任何事情.
BTW:运行node debug test.js确实启动了有效的命令行调试器.但它不像节点检查员.
我目前正在使用node和nodemon.然后我开始认为使用具有节点的检查器可能有时很好,所以已经开始使用node-inspector
但是,是否可以同时运行两个?
通常运行nodemon我会使用:
nodemon server.js
//and similarly
node-debug server.js
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
nodemon --debug http.js
Run Code Online (Sandbox Code Playgroud)
但遗憾的是,这也没有用.
但两者在一起!?
我已经安装了node-inspector,以发现它不支持断点:| 它有什么意义,请记住,大部分节点代码是异步的,你根本无法一步一步地遵循它?
我在这里肯定错过了一点......
无论如何用断点和一切来调试节点代码?
我正在尝试使用node-inspector调试运行babel-node的nodeJS应用程序.
babel-node index.js --debug
Run Code Online (Sandbox Code Playgroud)
节点检查器工作,但它在转换的es5而不是es6中显示源映射
我好像无法调试mocha脚本.
我可以用这样的检查器运行节点node --inspect script.js.然后这给了我一个去调试的网址,比如说chrome-devtools://devtools/remote/...
但是,当我使用mocha与此行时,mocha --inspect test.js我无法调试.它说'调试器监听[::]:5858'.有没有办法让我使用节点检查器调试mocha测试?
转到localhost:5858给了我这个信息:
Type: connect
V8-Version: 5.1.281.84
Protocol-Version: 1
Embedding-Host: node v6.9.1
Content-Length: 0
Run Code Online (Sandbox Code Playgroud)
使用--inspect --debug-brk没有帮助.
我可以在调用时将咖啡文件编译到与.coffee/.js文件相同的目录中的.map文件
coffee --nodejs --debug-brk app.coffee
Run Code Online (Sandbox Code Playgroud)
并启动节点检查器.应用程序文件的js版本以chrome格式加载.我错过了什么?
这是chrome为three.coffee文件显示的内容..
(function (exports, require, module, __filename, __dirname) { // Generated by CoffeeScript 1.6.2
(function() {
app.get('/three', function(req, res) {
debugger; return res.send('three/teedde');
});
}).call(this);
/*
//@ sourceMappingURL=three.map
*/
});
Run Code Online (Sandbox Code Playgroud)
谢谢
我使用节点检查了很多.当我编辑我的代码并重新启动时,我得到了不可避免的
与目标分离
新进程启动时出错.我总是要找到选项卡节点检查器已打开并重新启动它.
我想知道我是否可以避免这种情况.例如,从节点向节点检查器发送消息,告诉运行node-inspector的浏览器选项卡重新启动.
node-inspector ×10
node.js ×8
javascript ×3
debugging ×2
babeljs ×1
coffeescript ×1
gruntjs ×1
jestjs ×1
mocha.js ×1
nodemon ×1
v8 ×1