Khá mới đối với nútj ở đây. Tôi có một máy chủ web nodejs chạy phục vụ dữ liệu thông qua ajax. Bây giờ tôi cần mở rộng máy chủ để đáp ứng các yêu cầu đăng bài khác nhau. Tất cả tôi đang cố gắng để có được chạy là middleware bodyParser nhưng trên một máy tính phát triển khác nhau.Lỗi kết nối NodeJS - không có phương pháp 'logger'
os: debian nodejs: v0.10.29
đã chạy "NPM cài đặt kết nối" như người dùng bình thường và gốc
đang
var http = require('http');
var connect = require('connect');
var app = connect()
.use(connect.logger('dev'))
.use(connect.static('public'))
.use(connect.bodyParser())
.use(function(req, res){
res.end(JSON.stringify(req.body));
})
http.createServer(app).listen(2081);
nhận được đầu ra này carl @ crunchbang: ~/nodedev $ node ./test.js
/home/carl/nodedev/test.js:5
.use(connect.logger('dev'))
^
TypeError: Object function createServer() {
function app(req, res, next){ app.handle(req, res, next); }
merge(app, proto);
merge(app, EventEmitter.prototype);
app.route = '/';
app.stack = [];
return app;
} has no method 'logger'
at Object.<anonymous> (/home/carl/nodedev/test.js:5:16)
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
Tôi biết im thiếu một cái gì đó thực sự đơn giản giúp đỡ bất kỳ đánh giá cao.
cảm ơn :) Tôi thiết lập máy chủ web sản xuất một tháng hoặc lâu hơn trước đây có vẻ như đã thay đổi kể từ đó. Cảm ơn đống! – Carlhako