express - I'm trying to run Node.js chat application what I have downloaded from git hub. So I'm getting error like "object is not a function" -


this app.js code

var express = require('express');  var app = express();  var server = require('http').createserver(app);  var io = require('socket.io') (server);// encountered problem in line "(server)object not function"  var port = process.env.port || 3000; 

i run chat application , working fine.

the problem in line :

var io = require('socket.io') (server); 

try this:

var io = require('socket.io').listen(server); 

you forget write .listen(server)


Comments