Platform add android permissions issues?

So I’ve been banging my head against the wall for about two days on this and cant seem to get anything to work on Mac.

First of all when I run ionic platform add android I get the following:

ionic platform add android
Running command: /Users/MKremer/Documents/Projects/playground/myApp/hooks/before_platform_add/init_directories.js /Users/MKremer/Documents/Projects/playground/myApp
  Error: Attempt to unlock cordova-android@3.6.4, which hasn't been locked
at unlock (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/utils/locker.js:44:11)
at cb (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/cache/add-named.js:32:5)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/cache/add-named.js:41:20
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/utils/locker.js:30:7
at cb (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/lockfile/lockfile.js:149:38)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/lockfile/lockfile.js:177:38
at Object.oncomplete (fs.js:108:15)

Node has been installed using brew. I’ve tried all of the chown fixes I could find for this and nothing seems to work. I’ve uninstalled and reinstalled node. I’d love to fix this part, if anyone needs anymore information to help me out, just let me know what you need.

Now if I run sudo ionic platform add android (which I know is “wrong”) I still get this error:

Running command: /Users/MKremer/Documents/Projects/playground/myApp/hooks/before_platform_add/init_directories.js /Users/MKremer/Documents/Projects/playground/myApp
Creating android project...

/Users/MKremer/.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 /Users/MKremer/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/lib/check_reqs.js:159:19
    at _fulfilled (/Users/MKremer/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/Users/MKremer/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/Users/MKremer/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:760:13)
    at /Users/MKremer/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:821:14
    at flush (/Users/MKremer/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:442:13)
    at Function.Module.runMain (module.js:499:11)
    at startup (node.js:119:16)
    at node.js:929:3
Error: /Users/MKremer/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/create: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Process.ChildProcess._handle.onexit (child_process.js:833:5)

Even though both the android command exists and ANDROID_HOME exists as well:

echo $ANDROID_HOME
/usr/local/opt/android-sdk
sudo echo $ANDROID_HOME
/usr/local/opt/android-sdk

Running the android command merely starts some form of updater.

Any ideas? I’m stumped :’(

I got the same problem. I can add platform ios and run fine. but get the same error with android.