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

How to start it? #4

Open
skyiea opened this issue Jul 25, 2017 · 5 comments
Open

How to start it? #4

skyiea opened this issue Jul 25, 2017 · 5 comments

Comments

@skyiea
Copy link

skyiea commented Jul 25, 2017

Can't manage to make it work.
Both launch_development & launch_production & npm start give me next error:

Error: Cannot find module 'mongodb'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Development/SyncItBootstrap/node_modules/mongoskin/lib/index.js:14:13)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Manually installing npm i mongodb fixes this issue, but generates next:

/SyncItBootstrap/node_modules/mongoskin/lib/utils.js:33
  var skinClassName = 'Skin' + NativeClass.name;
                                          ^

TypeError: Cannot read property 'name' of undefined
    at makeSkinClass (/Development/SyncItBootstrap/node_modules/mongoskin/lib/utils.js:33:43)
    at Object.<anonymous> (/Development/SyncItBootstrap/node_modules/mongoskin/lib/grid.js:6:35)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Development/SyncItBootstrap/node_modules/mongoskin/lib/db.js:22:33)

After reading this thread I've downgraded mongoskin package to 1.3.20, and finally get:

> node app.js

Failed to load c++ bson extension, using pure JS version
DEVELOPMENT MODE
Express HTTP server listening on port 3000

Opening localhost:3000 gives me page's initial state (header & button to add new todo). But one resource is loading very long - GET /js/App.js (I'm thinking that's because on each request NodeJS is rebuilding it with Browserify). After 12s it is finally loaded, and an error in browser-console appear:

App.js:294 Uncaught TypeError: syncItCallbackToPromise(...).then(...).done is not a function
    at Object.frontApp [as front] (App.js:294)
    at (index):1

I've managed to avoid this error replacing done with then.
Then I clicked "Start new Todo", which was making another GET request to localhost, failing after 1 minute with an exception in the server console:

/Development/SyncItBootstrap/node_modules/mongoskin/node_modules/mongodb/lib/mongodb/mongo_client.js:378
          throw err
          ^

Error: SyncIt: MongoDB: Index:
    at /Development/SyncItBootstrap/node_modules/syncit-server/ServerPersist/Mongodb.js:48:11
    at onError (/Development/SyncItBootstrap/node_modules/mongoskin/lib/utils.js:27:7)
    at EventEmitter.<anonymous> (/Development/SyncItBootstrap/node_modules/mongoskin/lib/utils.js:85:15)
    at EventEmitter.g (events.js:291:16)
    at emitTwo (events.js:106:13)
    at EventEmitter.emit (events.js:191:7)
    at /Development/SyncItBootstrap/node_modules/mongoskin/lib/utils.js:134:27
    at EventEmitter.<anonymous> (/Development/SyncItBootstrap/node_modules/mongoskin/lib/collection.js:50:22)
    at EventEmitter.g (events.js:291:16)
    at emitTwo (events.js:111:20)

That was dead-end for me.

Any tip how to make it work?

@forbesmyester
Copy link
Owner

Hi,

I think what has happened is that MongoSkin used to bring in MongoDB with the correct version but now it does not, though I am not at all sure (have not done a proper investigation).

Anyway doing a npm i mongodb@1.4 will fix it.

I'll have a look at upgrading this project to newer libraries and MongoDB... Database access is pretty abstracted away and you can even make it use an in-memory database by just setting an environmental variable.

Anyway that should get you going.

Thanks for the bug report.

@skyiea
Copy link
Author

skyiea commented Jul 25, 2017

npm i mongodb@1.4 generates another error:

{ Error: Cannot find module '../build/Release/bson'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Development/SyncItBootstrap/node_modules/bson/ext/index.js:15:10)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3) code: 'MODULE_NOT_FOUND' }

Anyway thanks for your response. Would be awesome to see updated version of this project.
I've found another bootstrap project syncit-playground, will try to start from there.

@forbesmyester
Copy link
Owner

forbesmyester commented Jul 26, 2017 via email

@skyiea
Copy link
Author

skyiea commented Jul 27, 2017

Hey.
Everything started to work after changing host in config.ini to localhost.

(OSX. x64 CPU)

@skyiea skyiea closed this as completed Jul 27, 2017
@forbesmyester
Copy link
Owner

forbesmyester commented Jul 28, 2017

I suspect your Mongo is listening on the Mac equivelent of a UNIX socket whereas 127.0.0.1 forces it to use a TCP socket. I've set Mongo up using Docker for a long time and there is no UNIX socket binding for me... hence why I configured it for TCP....

I'm going to re-open this so I can remember to add something to to the docs so people know they might have to tweak the config setting.

Thanks again for the bug report.

@forbesmyester forbesmyester reopened this Jul 28, 2017
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

2 participants