i try to create simple express apllication serv.js
:
var express = require('express'),
app = express();
app.listen(3000, function() {
console.log('Server is running');
});
and when i run it node serv.js
, i've got error:
/home/leonid/proj/first/node_modules/express/lib/application.js:119
this._router.handle(req, res, function(err) {
^
TypeError: Cannot call method 'handle' of undefined
at Function.app.handle (/home/leonid/proj/first/node_modules/express/lib/application.js:119:16)
at Server.app (/home/leonid/proj/first/node_modules/express/lib/express.js:28:9)
at Server.EventEmitter.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2108:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
at Socket.socket.ondata (http.js:1966:22)
at TCP.onread (net.js:527:27)
How can it resolve?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…