express-debug“找不到堆栈”

时间:2015-02-14 16:57:22

标签: node.js express

我试图介绍一个简单的快速应用程序。当我运行节点时,它以

响应
throw new Error('Cannot find stack');
      ^
Error: Cannot find stack

这是代码

var express = require("express");
var app = express();
require('express-debug')(app, {});
app.get("/", function(request, response) {
    response.send("Hello world!");
});
app.get("/other", function(request, response) {
    var message = "";
    for(var ii = 0; ii < 10000; ++ii) {
         message = message + "x";
    }
    response.send(message);
});
app.listen(3000);

1 个答案:

答案 0 :(得分:8)

要解决您的问题,您必须在路线后调用express-debug,例如:

var express = require("express");
var app = express();
var debug = require('express-debug')
app.get("/", function(request, response) {
    response.send("Hello world!");
});
app.get("/other", function(request, response) {
    var message = "";
    for(var ii = 0; ii < 10000; ++ii) {
         message = message + "x";
    }
    response.send(message);
});

debug(app, {});
app.listen(3000);