Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run grunt serve after scaffolding #11

Open
seriema opened this issue Jun 14, 2014 · 4 comments
Open

Can't run grunt serve after scaffolding #11

seriema opened this issue Jun 14, 2014 · 4 comments

Comments

@seriema
Copy link

seriema commented Jun 14, 2014

I created a new project with yo klei and chose not to have Stylesheets, but I accepted the Todo app. Directly after I run grunt serve which gives me this:

$ grunt serve
Running "serve" task

Running "clean:temp" (clean) task
Cleaning .tmp...OK

Running "html2js:app" (html2js) task
Successfully converted 1 html templates to js.

Running "jshint:app" (jshint) task

✔ No problems


Running "injector:app" (injector) task
Missing option `template`, using `dest` as template instead
Injecting js files (8 files)
>> Nothing changed

Running "copy:index" (copy) task
Copied 1 files

Running "express:dev" (express) task
Starting background Express server
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
CONTROLLER-ACTION:ADD POST /api/todo
CONTROLLER-ACTION:ADD GET /api/todo/:id
CONTROLLER-ACTION:ADD PUT /api/todo/:id

Running "watch" task
Waiting...CONTROLLER-ACTION:ADD DELETE /api/todo/:id
CONTROLLER-ACTION:ADD GET /api/todo
DEVELOPMENT Server listening on port 1337

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: failed to connect to [localhost:27017]
    at null.<anonymous> (/Users/john-philipjohansson/Documents/GitHub/whatthee5/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:546:74)
    at EventEmitter.emit (events.js:106:17)
    at null.<anonymous> (/Users/john-philipjohansson/Documents/GitHub/whatthee5/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:150:15)
    at EventEmitter.emit (events.js:98:17)
    at Socket.<anonymous> (/Users/john-philipjohansson/Documents/GitHub/whatthee5/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:533:10)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)
@seriema
Copy link
Author

seriema commented Jun 15, 2014

Hmm I needed to start mongod first. Would be nice with a message or a task that starts it, instead of this random error.

@joakimbeng
Copy link
Member

It is stated in the readme that it's required to run MongoDB before running grunt serve.

But you're right, this could be clarified by wrapping the mongoose.connect call with a try-catchstatement.

@duyongguang
Copy link

I run the same code, in linux,It is OK,
but in windows return the errors ,
when I run server

Error: failed to connect to [182.192.145.121:27017]
at null. (D:\workspace\xxx\node_modules\mongoose\node_mod
ules\mongodb\lib\mongodb\connection\server.js:546:74)
at EventEmitter.emit (events.js:106:17)
at null. (D:\workspace\xxx\node_modules\mongoose\node_mod
ules\mongodb\lib\mongodb\connection\connection_pool.js:150:15)
at EventEmitter.emit (events.js:98:17)
at Socket. (D:\workspace\xxx\node_modules\mongoose\node_m
odules\mongodb\lib\mongodb\connection\connection.js:533:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)

@joakimbeng
Copy link
Member

And you are sure that there is a mongodb instance running on 182.192.145.121:27017?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants