Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

express-debug "cannot find stack"

I'm trying to profile a simple express application. When I run node it responds with

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

Here's the code

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);
like image 472
MKaras Avatar asked Feb 10 '23 22:02

MKaras


1 Answers

To solve your problem you must call express-debug after your routes, for example:

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);
like image 55
siavolt Avatar answered Feb 16 '23 11:02

siavolt