5

I have this error:

TypeError: object is not a function
at Object.CALL_NON_FUNCTION (native)

For this line:

var app=express();

I tryed to install express/connect again, but.. nothing.

Thanks!

EDIT

I'm express 2.5.8.

my code:

error:

    var http=require('http');
    var app=express();
    var server=http.createServer(app);

(i forget why i need to use this code, i think for cookie handshake works. I have resole the probleme (hanskake cookie) editing manager.js, so i dont need to use this code. But can be interesting to understand why no works (and why i wanted to use)).

no error: var app=express.createServer();

4
  • We need more of your code, show us how you require the Express lib. Commented Apr 20, 2012 at 13:46
  • Also, please submit the Express version. The API changed quite a bit between 2.* and 3.0.0alpha. Commented Apr 20, 2012 at 14:14
  • it seems that you are using version 2.x, in 2.x use 'var app = express.createServer();' To see the version, run in console 'express -v' or see 'package.json' of express module Commented Apr 20, 2012 at 15:40
  • 1
    i'm very sorry, i use this code because i need this to resolve a problem with handshake cookie, but i forget what. So i'm 2.5.8. I require express like that: expres=require('express'); Commented Apr 22, 2012 at 12:29

1 Answer 1

12

You have the wrong express version. You can only create the server with express() in v3.x.x. Before this version, express can not be called as a Function. Try either changing your code to create the app the old way or try updating express.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.