server启动服务器时出错

server启动服务器时出错

本文介绍了使用grunt或node server启动服务器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用如下所述的平均堆栈:

I am trying to use the mean stack as described here : http://mean.io/

安装后,当发出咕噜时出现错误:

after install, when making "grunt", there is an error :

debugger listening on port 5858
4 Jan 01:47:40 - [nodemon] reading ignore list
Express app started on port 3000

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: failed to connect to [localhost:27017]
    at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
    at EventEmitter.emit (events.js:106:17)
    at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
    at EventEmitter.emit (events.js:98:17)
    at Socket.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)
4 Jan 01:47:40 - [nodemon] app crashed - waiting for file changes before starting...

我按照网站上的指示进行了故障排除:更新咕噜声,凉爽和清洁npm和低音缓存工作得很好但是更新npm也会发生错误:

I tried the troubleshooting as specified on the site : Updating Grunt, bower and cleaning npm and bower caches worked well. but updating npm gives an error too:

npm ERR! error rolling back Error: Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm

这看起来像一个。
但无论如何,我已安装版本1.3.21。

This looks like a conflict between homebrew and npm.but anyway i have version 1.3.21 installed.

当我尝试节点服务器时,出现同样的错误。

There is the same error when i am trying node server.

你有什么想法可以使服务器工作吗?

do you have an idea on what i can do to make the server work ?

推荐答案

这可能太简单了,但是似乎您的MongoDB服务器实际上没有运行。安装Mongo(在Mac上,我假设?),你必须打开一个终端窗口/选项卡,运行 mongod 并保持运行(或使用屏幕等)。您可以通过键入 mongo 来访问MongoDB CLI,以确保服务器正在运行。

It may be too easy, but seems like your MongoDB server is not actually running. After having installed Mongo (on your Mac, I assume?), you have to open a Terminal window/tab, run mongod and leave it running (or use screen, etc.). You can try to access MongoDB CLI by typing mongo to make sure the server is running.

这篇关于使用grunt或node server启动服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:28