ltonetwork / mongodb-rest

JSON REST server for MongoDB (using node.js)
MIT License
405 stars 143 forks source link

Not able to start #10

Closed mgd216 closed 13 years ago

mgd216 commented 13 years ago

Greetings,

I'm trying to get mongodb-rest running on Ubuntu 10.10. I have node.js and npm installed:

me@TestBox:~/dev_apps$ sudo npm install mongodb-rest npm info it worked if it ends with ok npm info using npm@0.3.18 npm info using node@v0.5.0-pre npm info preinstall mongodb-rest@0.6.6 npm info install mongodb-rest@0.6.6 npm info postinstall mongodb-rest@0.6.6 npm info predeactivate mongodb-rest@0.6.6 npm info deactivate mongodb-rest@0.6.6 npm info postdeactivate mongodb-rest@0.6.6 npm info preactivate mongodb-rest@0.6.6 npm info activate mongodb-rest@0.6.6 npm info postactivate mongodb-rest@0.6.6 npm info build Success: mongodb-rest@0.6.6 npm ok

me@TestBox:~/dev_apps$ sudo mongodb-rest

node.js:178 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: Object # has no method 'bodyDecoder' at HTTPServer. (/usr/local/lib/node/.npm/mongodb-rest/0.6.6/package/server.js:29:21) at HTTPServer.configure (/usr/local/lib/node/.npm/express/2.1.1/package/lib/http.js:434:8) at Object. (/usr/local/lib/node/.npm/mongodb-rest/0.6.6/package/server.js:28:5) at Module._compile (module.js:404:26) at Object..js (module.js:410:10) at Module.load (module.js:336:31) at Function._load (module.js:297:12) at require (module.js:348:19) at Object. (/usr/local/lib/node/.npm/mongodb-rest/0.6.6/package/bin/mongodb-rest:8:17) at Module._compile (module.js:404:26)

Looking to get an example running with SproutCore and Mongo, your REST interface looks perfect. Any help would be much appreciated, thanks.

Matt

tdegrunt commented 13 years ago

Haven't tried node 0.5.0 yet, a little too new. I've tried with 0.4.2 and that seems to work!

benjamine commented 13 years ago

Isn't this related to Express? do you have Express installed?

mgd216 commented 13 years ago

Thanks for the quick response, a bit new to node.js. I confirmed that express was installed:

me@TestBox:~/dev_apps$ sudo npm install express@latest npm info it worked if it ends with ok npm info using npm@0.3.18 npm info using node@v0.5.0-pre npm info range connect@>= 1.1.6 < 2.0.0 npm info preinstall connect@1.2.0 npm info preinstall express@2.2.0 npm info install connect@1.2.0 npm info postinstall connect@1.2.0 npm info predeactivate connect@1.1.5 npm info deactivate connect@1.1.5 npm info postdeactivate connect@1.1.5 npm info preactivate connect@1.2.0 npm info activate connect@1.2.0 npm info postactivate connect@1.2.0 npm info install express@2.2.0 npm info postinstall express@2.2.0 npm info predeactivate express@2.1.1 npm info deactivate express@2.1.1 npm info postdeactivate express@2.1.1 npm info preactivate express@2.2.0 npm info activate express@2.2.0 npm info postactivate express@2.2.0 npm info build Success: connect@1.2.0 npm info build Success: express@2.2.0 npm ok

From the log, appears express version 2.2.0 is installed. I see your point that 0.5.0 might be a bit new, is there a way to 'down-grade' to the 0.4.2 version? Thanks for your help.

Matt

benjamine commented 13 years ago

I'm not familiar with this project, but googling a bit, it seems that bodyDecoder has been renamed on Express 2, check out this topic: https://groups.google.com/forum/#!topic/express-js/gkbCAhVewbs

the answer seems to be: "Change .bodyDecoder() to .bodyParser() and .cookieDecoder() to .cookieParser(). .staticProvider() is also now .static()."

You can try using Express 1, maybe @tdegrunt can confirm this. I don't know if compatibility with Express 2 is planned.

mgd216 commented 13 years ago

benjamine, you are correct, looks like a version issue. I'm trying to get the 1.0.9 version of express installed, but can not figure out how to 'revert' the 2.1.1 version back to 1.0.9.

Trying: sudo npm install express@1.0.9

But just getting: Error: version not found: 1.0.9 : express/1.0.9

Maybe I'll try getting the source code down and configuring it to work with 2.1.1 with the changes you noted above. Thanks again.

Matt

tdegrunt commented 13 years ago

It most certainly was a version issue. Hadn't updated it to Express 2.2 at all. Just update to mongodb-rest@0.6.7, should fix your issue. Still haven't tried it with node 0.5-pre though.

Thank you!

mgd216 commented 13 years ago

Tom,

Awesome, thanks for the quick update, that did the trick! Still getting up to speed on a lot of things. I've been a Java middle ware programmer for 6 years, need something new and exciting, this is very cool. Thanks for your help.

Matt