我有以下文件:node.js中不能正常工作時,Windows 7
var express = require('express'),
http = require('http'),
app = express(),
httpServer = http.createServer(app);
app.configure(function() {
app.set('port', 3000);
app.use(express.static(__dirname + '/public'));
});
httpServer.listen(app.get('port'), function() {
console.log("Express server listening on port %s.", httpServer.address().port);
});
但是這給後續的錯誤:
C:\var\www\stage.mayfieldafc.com>nodemon http.js
18 Jul 01:19:29 - [nodemon] v1.2.1
18 Jul 01:19:29 - [nodemon] to restart at any time, enter `rs`
18 Jul 01:19:29 - [nodemon] watching: *.*
18 Jul 01:19:29 - [nodemon] starting `node http.js`
C:\var\www\stage.mayfieldafc.com\http.js:8
app.configure(function() {
^
TypeError: Object function (req, res, next) {
app.handle(req, res, next);
} has no method 'configure'
at Object.<anonymous> (C:\var\www\stage.mayfieldafc.com\http.js:8:5)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
18 Jul 01:19:29 - [nodemon] app crashed - waiting for file changes before starting...
同時安裝nodemon
和express
,我可以看到後都裏面的文件夾node_modules
此外,當控制檯記錄express
返回我看到它有correc tly加載模塊。
如何驗證我的節點安裝?或者更好的解決它。