Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor with cloud9

When trying to run meteor in cloud9 I encounter one of the following errors:

Running the older modified version from cloud9 I get the error:

No dependency info in bundle. Filesystem monitoring disabled.
=> Errors prevented startup:
Exception while bundling application:
Error: Package not found: standard-app-packages
    at self.api.use (/var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/tools/bundler.js:113:17)
    at Array.forEach (native)
    at Function._.each._.forEach (/var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
    at Object.self.api.use (/var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/tools/bundler.js:110:9)

When I try running the lastest version, I get an error from cloud9:

Cloud9  Error: you may be using the wrong PORT & HOST for your server app
        Node: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts. See also https://c9.io/site/blog/2013/05/can-i-use-cloud9-to-do-x/

In both cases, I clone the corresponding GitHub repository and run export BIND_IP=$IP as well as export PORT=20000 (as it is described in on several posts). I also gave up the hope using the default MongoDB server and am instead exporting MONGO_URL to a free database hosted on https://www.mongohq.com/.

I've also tried to merge the pull request from cloud9's meteor version to the master, but those files don't even exist anymore. Everything else I could find was about Meteor version 0.6.5 and 0.5

Trying to modify the latest Meteor-version I looked for the httpServer.listen call, but I found only one in meteor/packages/webapp/webapp_server.js, and it seems that the cloud9 error is thrown before that part of code is reached (if it is ever reached). So that there must be a another piece of code which is bound to the wrong address or port.

The plugins I use are:

standard-app-packages
insecure
preserve-inputs
underscore
backbone
jquery
accounts-ui
accounts-base
accounts-password
accounts-facebook
accounts-google
coffeescript

Update:

After some more hours looking for a solution, I got much further. The problem was in meteor/tools/run-proxy.js:

In line 94 you can see: self.server.listen(self.listenPort, function () { here is the corresponding IP-address missing to which the server should bind itself. Now meteor used to use an environmental variable BIND_IP which we could introduce here again, but this would have unnecessary additional changes on cloud9, since they export the current IP address to which a service should bind itself in the IP variable. So I changed the line in question to: self.server.listen(self.listenPort, process.env.IP, function () {

I've also additionally modified meteor/tools/run-all.js, since I wasn't sure if the correct port parameter is used. On line 24 I exchanged var listenPort = options.port; with var listenPort = process.env.PORT;

While I can now finally start the application, it is still not running and I'm getting the following output:

=> Running Meteor from a checkout -- overrides project version (0.7.2)
[[[[[ ~/<PROJECT_ID>/<PROJECT_NAME> ]]]]]

=> Started proxy.
W20140321-22:31:42.591(-4)? (STDERR) 
W20140321-22:31:43.036(-4)? (STDERR) events.js:72
W20140321-22:31:43.037(-4)? (STDERR)         throw er; // Unhandled 'error' event
W20140321-22:31:43.037(-4)? (STDERR)               ^


 Cloud9  Error: you may be using the wrong PORT & HOST for your server app
         Node: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts. See also https://c9.io/site/blog/2013/05/can-i-use-cloud9-to-do-x/
W20140321-22:31:43.108(-4)? (STDERR) Error: listen EACCES
W20140321-22:31:43.109(-4)? (STDERR)     at errnoException (net.js:901:11)
W20140321-22:31:43.109(-4)? (STDERR)     at Server._listen2 (net.js:1020:19)
W20140321-22:31:43.111(-4)? (STDERR)     at listen (net.js:1061:10)
W20140321-22:31:43.111(-4)? (STDERR)     at net.js:1143:9
W20140321-22:31:43.112(-4)? (STDERR)     at dns.js:72:18
W20140321-22:31:43.112(-4)? (STDERR)     at process._tickCallback (node.js:415:13)
=> Exited with code: 8

However meteor doesn't crash and the exceptions keep coming in one after another. That's why I first thought, the exception is due to an authentication error on MongoDB, since also Error-Code 8 for MongoDB is authentication error, but this is what I get when I use an invalid username + password on my MongoHQ-hosted database:

[...]
=> Started proxy.
W20140321-22:54:17.282(-4)? (STDERR) 
W20140321-22:54:18.700(-4)? (STDERR) /var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/mongo_client.js:400
W20140321-22:54:18.777(-4)? (STDERR)               throw err
W20140321-22:54:18.778(-4)? (STDERR)                     ^
W20140321-22:54:18.778(-4)? (STDERR) MongoError: auth fails
W20140321-22:54:18.778(-4)? (STDERR)     at Object.toError (/var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/utils.js:110:11)
W20140321-22:54:18.779(-4)? (STDERR)     at /var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/auth/mongodb_cr.js:34:33
W20140321-22:54:18.779(-4)? (STDERR)     at /var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/db.js:1670:9
W20140321-22:54:18.779(-4)? (STDERR)     at Server.Base._callHandler (/var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/connection/base.js:382:41)
W20140321-22:54:18.780(-4)? (STDERR)     at /var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/connection/server.js:472:18
W20140321-22:54:18.780(-4)? (STDERR)     at MongoReply.parseBody (/var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
W20140321-22:54:18.780(-4)? (STDERR)     at null.<anonymous> (/var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/connection/server.js:430:20)
W20140321-22:54:18.781(-4)? (STDERR)     at EventEmitter.emit (events.js:95:17)
W20140321-22:54:18.781(-4)? (STDERR)     at null.<anonymous> (/var/lib/stickshift/532a1c97500446885f0002a8/app-root/data/meteor/packages/mongo-livedata/.build/npm/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:191:13)
W20140321-22:54:18.782(-4)? (STDERR)     at EventEmitter.emit (events.js:98:17)
=> Exited with code: 8

This error is thrown in meteor/packages/mongo-livedata/mongo_driver.js at line 149:

147:      MongoDB.connect(url, mongoOptions, function(err, db) {
148:        if (err)
149:          throw err;
150:        self.db = db;

This is also OK, however I couldn't find where the other error comes from, which occurs, when my credentials are correct.

like image 976
peter Avatar asked Mar 21 '14 14:03

peter


1 Answers

I just ran into similar issues initially, but the latest version of Meteor (0.9.0) makes this easy at least.

meteor run --port=$IP:$PORT

Seems to do the trick (at least so far)

This is doc'd in

meteor help run

hth

Andy

like image 184
Andrew Price Avatar answered Oct 20 '22 10:10

Andrew Price