Meteor + Cordova + Mupx problems

Mupx stands for Meteor Up X - x stands for unreleased. Currently as I'm writing this it means the new mup that uses Docker.

It seems that both cordova and mupx are pretty unstable. them together is like sitting in a bugs nest.

1. General tip

Usually if you app fails to deploy first stop the app, then setup and deploy again. If you're using cordova, first delete the .meteor/local folder from where your source code is.

rm -rf <path to source>/.meteor/local
mupx stop
mupx setup
mupx deploy

2. ENOENT

Error:

Error: ENOENT, readdir '/srv/toitla-app/.meteor/local/cordova-build/platforms/android/ant-build'

You need to remove your .meteor/local

rm -rf <path to app source files>/.meteor/local/

If that doesn't help see issue 453

3. --server option

Error

-------------------STDERR-------------------
Supply the server hostname and port in the --server option
for mobile app builds.

This error actually only rises with normal mup. It's why you need to start using mupx.

4. Installing MongoDB: FAILED

Error

Started TaskList: Setup (linux)
[homecooks] - Installing Docker
[homecooks] - Installing Docker: SUCCESS
[homecooks] - Setting up Environment
[homecooks] - Setting up Environment: SUCCESS
[homecooks] - Copying MongoDB configuration
  nodemiral:sess:homecooks copy file - src: /usr/lib/node_modules/mupx/templates/linux/mongodb.conf, dest: /opt/mongodb/mongodb.conf, vars: undefined +0ms
[homecooks] - Copying MongoDB configuration: SUCCESS
[homecooks] - Installing MongoDB
[homecooks] x Installing MongoDB: FAILED

    -----------------------------------STDERR-----------------------------------
    time="2015-05-27T20:43:41+03:00" level=fatal msg="Error response from daemon: Cannot start container 79f8ca1d00a4af48965500be934bda1fd14bb9de3af9d909ed462b4e597821af: Error starting userland proxy: listen tcp 127.0.0.1:27017: bind: address already in use" 
    -----------------------------------STDOUT-----------------------------------
    latest: Pulling from mongo
    7a3e804ed6c0: Already exists
    b96d1548a24e: Already exists
    8f7d72c36980: Already exists
    ed130ec41052: Already exists
    38d67eafa679: Already exists
    4d8522822453: Already exists
    3cac3354324b: Already exists
    0eb1ebbf9bce: Already exists
[TRUNCATED]

You need to properly migrate from old mup.

5. Verifying deployment: FAILED

Error

[TRUNCATED]
[homecooks] - Initializing start script
[homecooks] - Initializing start script: SUCCESS
[homecooks] - Invoking deployment process
[homecooks] - Invoking deployment process: SUCCESS
[homecooks] - Verifying deployment
[homecooks] x Verifying deployment: FAILED
	
	-----------------------------------STDERR-----------------------------------
	l: (52) Empty reply from server
	  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
	                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
	curl: (52) Empty reply from server
[TRUNCATED]

This means the deploy went fine, but verification failed. It's an odd one, but in my case stopping all other apps on the server helped.

It seems that different deployments may conflict eachother pretty easily. I have no resolution for this.

6. ANDROID_HOME is not set

Error

Error while building for mobile platforms: Error running
/root/.meteor/packages/meteor-tool/.1.1.3.jnvn1i++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/tools/cordova-scripts/cordova.sh

/root/.meteor/android_bundle/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:126
throw e;
^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must
fulfill at least one of these conditions.
at

[TRUNCATED]

Find where the sdk is located with

find / | grep "android-sdk"

and exported the PATHs:

export ANDROID_HOME=/<installation location>/android-sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

I suggest you add these to your .bashrc.

7. address already in use

Error

[45.55.223.62] - Invoking deployment process
[45.55.223.62] x Invoking deployment process: FAILED

-----------------------------------STDERR-----------------------------------
Error response from daemon: no such id: base2industries-frontend
time="2015-05-20T12:42:06-04:00" level=fatal msg="Error: failed to remove one or more containers" 
time="2015-05-20T12:42:12-04:00" level=fatal msg="Error response from daemon: Cannot start container 5dcad6e12718cd902953c2c17cb9e51cde734149c604cc7f4eb44666d3d6014e: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use" 
-----------------------------------STDOUT-----------------------------------
base2industries
base: Pulling from meteorhacks/meteord
21e4345e9035: Already exists
b3d362b23ec1: Already exists
56031332072b: Already exists
f88e209e7818: Already exists

This means port 80 is not available. I've fount it easier to just switch the used port in mup.json, somehow nothing works to free it up. It'll be free in a couple of days.

8. APK not found

Error

Error: The APK file for the Android build was not found.

The tips from nr 1 have helped me.