我在调试场景中还很陌生,尤其是使用 Node 检查器。
安装完 Node 检查器后,我使用 --debug 参数启动了简单的 Node 应用程序,并且能够在 localhost:8080/debug?port=5858 处看到调试 View 。
当我让应用程序在此断点处停止时:
router.get('/people', function(req, res) {
var num = 1;
var str = 'rarf';
var obj = {x: 1, y: 2}
console.log(req) // breakpoint
});
将光标悬停在标识符上,显示如下:
- 请求:传入消息 - 无属性
- res:服务器响应 - 无属性
- str: "拉尔夫"
- 数字:1
- obj:对象 - 无属性
为什么我看不到对象的属性?
最佳答案
我也遇到了同样的问题。我的 Node 版本是0.10.35(稳定)。但是当我使用 Node 版本 0.11.13(unstable)
或更高版本时,这个问题就消失了。因此,您可以尝试将 Node 版本更新到使用工具 n
的 0.11.13
。使用 npm install -g n
命令安装 n
。
关于node.js - Node 检查器显示对象为 'No Properties',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27830963/