我正在关注this blog
上的“使用PassportJS进行身份验证”这个教程从https://github.com/DanialK/PassportJS-Authentication的回购邮件中下载文件。我安排了终端指示我的包裹。然后我尝试再次运行应用程序,但得到了这个
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
Express server listening on port 3000
events.js:66
throw arguments[1]; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at Server.connect.connectionPool.on.server._serverState (/Users/juangallardo/Desktop/PassportJS-Authentication-master/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
at EventEmitter.emit (events.js:115:20)
at connection.on._self._poolState (/Users/juangallardo/Desktop/PassportJS-Authentication-master/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
at EventEmitter.emit (events.js:91:17)
at Socket.errorHandler (/Users/juangallardo/Desktop/PassportJS-Authentication-master/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
at Socket.EventEmitter.emit (events.js:88:17)
at Socket._destroy.self.errorEmitted (net.js:335:14)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
答案 0 :(得分:0)
问题是我没有运行MongoDB
我发现“问题”discussed on GitHub
然后获得了从this tutorial
安装和运行mongo的说明brew install mongodb
然后您只需使用
从终端启动mongo服务器mongod
然后回到你的项目中,只需用
启动应用程序node app.js