Pessoal, até agora o projeto estava tudo ok. Porém, na tentativa de conexão com o banco MongoDB, exibe um erro no terminal:
C:\Alura\alurapic\node_modules\mongoose\node_modules\mongodb\lib\server.js:235
process.nextTick(function() { throw err; })
^
Error: connect ECONNREFUSED 127.0.0.1:27017
at Object.exports._errnoException (util.js:874:11)
at exports._exceptionWithHostPort (util.js:897:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v4.2.3
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! alurapic@1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the alurapic@1.0.0 start script 'node server.js'.
npm ERR! This is most likely a problem with the alurapic package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls alurapic
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Alura\alurapic\npm-debug.log
Os códigos para server.js e database.js estão assim (idênticos aos que são passados na aula):
//server.js
var http = require('http');
var app = require('./config/express');
require('./config/database');
http.createServer(app)
.listen(3000, function() {
console.log('Servidor iniciado');
});
//database.js
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/alurapic');
mongoose.connection.on('connected', function() {
console.log('Conectado ao MongoDB')
});
Estou rodando em Windows 8.1, e o MongoDB possui seu diretório em C:/mongodb/, e o projeto do alurapic está em C:/Alura/alurapic/.
Onde será que está o problema?