0

I just installed keystone for a personal project and to learn it. After install I just run the command node keystone but this error shows:

{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
------------------------------------------------
Mongo Error:

[Error: failed to connect to [localhost:27017]]
/Users/msantamaria/Documents/dev/presonal_projects/test-keystone/node_modules/keystone/lib/core/mount.js:616
        throw new Error('KeystoneJS (' + keystone.get('name') + ') failed to start');
        ^

Error: KeystoneJS (test-keystone) failed to start
    at NativeConnection.<anonymous> (/Users/msantamaria/Documents/dev/presonal_projects/test-keystone/node_modules/keystone/lib/core/mount.js:616:10)
    at emitOne (events.js:77:13)
    at NativeConnection.emit (events.js:169:7)
    at NativeConnection.Connection.error (/Users/msantamaria/Documents/dev/presonal_projects/test-keystone/node_modules/mongoose/lib/connection.js:389:8)
    at /Users/msantamaria/Documents/dev/presonal_projects/test-keystone/node_modules/mongoose/lib/connection.js:416:14
    at /Users/msantamaria/Documents/dev/presonal_projects/test-keystone/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:57:21
    at /Users/msantamaria/Documents/dev/presonal_projects/test-keystone/node_modules/mongodb/lib/mongodb/db.js:286:18
    at /Users/msantamaria/Documents/dev/presonal_projects/test-keystone/node_modules/mongodb/lib/mongodb/db.js:365:7
    at doNTCallback0 (node.js:428:9)
    at process._tickCallback (node.js:357:13)

I've been reading a lot around but I cant find a fix for this, many suggest changing the node version, others that deleting node_modules and doing a npm install again will fix it, but with no luck.

Thanks in advance, this are my specs:

OS:      Mac OSX 10.10.5
node:    v5.0.0
npm:     v3.3.6
Python:  2.7.10
Mongo:   3.2.1
TylerH
  • 20,799
  • 66
  • 75
  • 101
migsan
  • 51
  • 8
  • It can't connect to your MongoDB instance. What happens when you run `mongo localhost:27017` in Terminal? – Pier-Luc Gendreau Feb 09 '16 at 15:30
  • @Pier-LucGendreau This is what happens when I run `mongo localhost:27017` `MongoDB shell version: 3.2.1` `connecting to: localhost:27017/test` `2016-02-09T11:29:29.027-0500 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused` `2016-02-09T11:29:29.028-0500 E QUERY [thread1] Error: couldn't connect to server localhost:27017, connection attempt failed :` `connect@src/mongo/shell/mongo.js:226:14 @(connect):1:6` `exception: connect failed` thanks. – migsan Feb 09 '16 at 16:31

2 Answers2

1

This is the important part of the error message:

Mongo Error: [Error: failed to connect to [localhost:27017]]

Keystone is not able to connect to your database which you can also confirm by running the following command in Terminal:

mongo localhost:27017

It's hard to tell the exact cause, but you should have a look at the relevant documentation to install MongoDB Community Edition on OS X.

Pier-Luc Gendreau
  • 13,553
  • 4
  • 58
  • 69
  • Well this was one part of the problem, but the issue after reinstalling and checking mongo remains. This is what I'm getting right now: { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version /Users/msantamaria/Documents/dev/presonal_projects/test-keystone/node_modules/keystone/lib/core/mount.js:327 throw e; ^ now the problem is just about the bson module. Thanks again for the quick response. – migsan Feb 10 '16 at 13:45
  • Ok, found the issue, first the bson problems was fixed using [this answer](http://stackoverflow.com/questions/28651028/cannot-find-module-build-release-bson-code-module-not-found-js-bson) (copying the bson file to the other folder) and lastly I had mongo installed but it was not running, just did a `mongod` in terminal before running `node keystone` and is working like a charm now. – migsan Feb 10 '16 at 14:27
0

Had the same issue like you yesterday! Solving the problem for me was to give me all right to the /data/db :) I had only rights to read. After doing that, my server starts and the website runs on localhost. Now I'm trying to customise the website. Pretty hard for me ^^