【发布时间】:2016-02-20 05:20:40
【问题描述】:
每当我在 webstorm 上运行我的 index.js 文件时,我都会收到以下错误:
process.nextTick(function() { throw err; })
^
Error: connect ECONNREFUSED 127.0.0.1:27017
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
Process finished with exit code 1
这是我的index.js 文件:
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/cats');
app.use (bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
var cats = require('./cat_routes.js')(app);
var server = app.listen(3000, function(){
console.log('running at 3000');
});
我正在与一些教程一起学习,但这是一个我不太了解的非常奇怪的错误。
【问题讨论】: