TypeError: Object #<Object> has no method 'listen' #37

codesplicer opened this Issue Jun 23, 2011 · 4 comments

4 participants


Keep getting this error when running the following code against my expressjs app:

var app     = require('../app'),
    assert  = require('assert'),
    tobi    = require('tobi'),
    vows    = require('vows'),
    browser = tobi.createBrowser(app);

browser.get('/login', function(res, $){

Not sure what's causing this behavior.

LearnBoost member
tj commented Jun 23, 2011

hmm can you post the stack trace?

Error: Debug
    at Object.<anonymous> (/Users/vik/local_repository/myapp/test/app.test.js:16:10)
    at Module._compile (module.js:404:26)
    at Object..js (module.js:410:10)
    at Module.load (module.js:336:31)
    at Function._load (module.js:297:12)
    at Array.0 (module.js:423:10)
    at EventEmitter._tickCallback (node.js:126:26)
Caught exception: TypeError: Object #<Object> has no method 'listen'

did you solve your problem?

i get the same message using tobi (same code as above). weird thing i also get this using zombiejs or mocha testing tools.

i'm using node 0.6.2 on ubuntu 10.04 and got the modules via npm install


probably you do not export your app from your server

app     = require('../app'),

you should check what app is, my guess is that it's {}

what can you do? simply write in your ../app the following:

var app = module.exports = express.createServer();

to get your app exported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment