0

I try to set up my first project using KeystoneJS but when I try to use "node keystone" I receive the following error. Can anyone explain to me why is that?

Mongo Error:

[Error: failed to connect to [localhost:27017]]
/Users/marius/Desktop/doner/node_modules/keystone/lib/core/mount.js:606
            throw new Error('KeystoneJS (' + keystone.get('name') + ') failed to start'
                  ^
Error: KeystoneJS (Doner) failed to start
    at NativeConnection.<anonymous> (/Users/marius/Desktop/doner/node_modules/keystone/lib/core/mount.js:606:10)
    at NativeConnection.emit (events.js:107:17)
    at NativeConnection.Connection.error (/Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/lib/connection.js:389:8)
    at /Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/lib/connection.js:416:14
    at /Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:57:21
    at /Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:286:18
    at /Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:364:18
    at Server.close (/Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:192:38)
    at Db.close (/Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:360:21)
    at /Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:284:21
    at null.<anonymous> (/Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:565:7)
    at emit (events.js:118:17)
    at null.<anonymous> (/Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
    at emit (events.js:110:17)
    at Socket.<anonymous> (/Users/marius/Desktop/doner/node_modules/keystone/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
    at Socket.emit (events.js:107:17)
dovid
  • 6,354
  • 3
  • 33
  • 73
Flap Jack
  • 97
  • 1
  • 14

2 Answers2

1

Keystone could not connect to mongodb. Keystone doesn't manage MongoDB for you. So make sure MongoDB is running before "node keystone".

Molda
  • 5,619
  • 2
  • 23
  • 39
0

You need to run mongod.

On mac:

sudo mongod

this will run mongodb and open a new terminal and after that run

node keystone

Same for windows if mongod is included in your path file other wise go to the directory where mongodb is located and run mongod.exe it should be in

program files/MongoDB/server/3.2/bin

Mostafiz
  • 7,243
  • 3
  • 28
  • 42
hamadkh
  • 359
  • 1
  • 16