node.js express.js对象不是函数call_non_function [英] node.js express.js object is not a function call_non_function
问题描述
我有这个错误:
TypeError: object is not a function
at Object.CALL_NON_FUNCTION (native)
对于这一行:
var app=express();
我尝试再次安装快递/连接,但没有。
I tryed to install express/connect again, but.. nothing.
谢谢!
编辑
m express 2.5.8。
I'm express 2.5.8.
我的代码:
错误:
var http=require('http');
var app=express();
var server=http.createServer(app);
(我忘了为什么我需要使用这个代码,我认为为了进行cookie握手工作
我有resole the questionsme(hanskake cookie)editing manager.js,所以我不需要使用这个代码,但可以很有趣的是为什么没有作品(为什么我想使用)。
(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)).
没有错误:
var app = express.createServer();
推荐答案
你的快递版本错误。您只能使用v3.x.x中的 express()
创建服务器。在此版本之前,express不能被称为Function。尝试更改您的代码以创建应用程序的旧方式或尝试更新快递。
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.
这篇关于node.js express.js对象不是函数call_non_function的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!