node.js express.js object is not a function call_non_function

爷,独闯天下 提交于 2020-01-13 10:06:32

问题


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();


回答1:


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.



来源:https://stackoverflow.com/questions/10247287/node-js-express-js-object-is-not-a-function-call-non-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!