node.js – Cordova android build fails immediately [Error: spawn EACCES]-ThrowExceptions

Exception or error:

I am just getting started with with Cordova ( PhoneGap ) and trying to build my first project with it, however I am running into a problem with my compilation step- when I try to build ( in tracking down the problem I broke down the build step into prepare and compile and the former works fine as far as I know ) I see this:

~/Projects/MyProject$ cordova compile android
Compiling app on platform "android" via command "/media/glenatron/local disk/Projects/Cordova/MyProject/platforms/android/cordova/build" 
{ [Error: spawn EACCES] code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }

Now from what I can tell this is a permissions problem, but having no Node or Cordova experience yet I am at a loss as to how to troubleshoot it. It looks as though it is trying to spawn another process – maybe the Android SDK? – and it is failing.

Is there a way I can ask Node or Cordova to give me more information on what is going on or is there a log file somewhere that will help me to track down what the problem is?

Edit: I realised cordova has a --verbose switch and when I activated it I get the above output with an additional couple of lines…

Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

Unfortunately, they don’t seem to actually give much more information, like which process it can’t start.

How to solve:

It’s a permission issue, just execute:

chmod 777 "/media/glenatron/localdisk/Projects/Cordova/MyProject/platforms/android/cordova/build"

That should fix the problem.


For me, this has fixed it:

chmod 777 /Applications/Android\


Using verbose like Solidak suggested works.

cordova build --release --verbose android

The last command was to access /platforms/android/gradlew so i chmod +x that file and it worked.


Its different for every one, I guess. Running --verbose would give you the file that Cordova needs access to. From there you can chmod 777 <file>. The command you should run to figure out the inaccessible file looks like this: cordova build --release --verbose android


I was facing the same issue. In my case, I had put the sample cordova project on a different ext3 partition than home folder. Since the partition was not NTFS, permissions shouldn’t have been a problem. But when I tried all suggested methods (changing permissions, making everything executable), none of them worked. This problem went away as soon as I created the sample cordova folder in my home partition.


For MAC users change the name from “Android Studio” to AndroidStudio. My cordova build was taking back slash() in name of android studio so i changed the name of app.
It is working for me.

Leave a Reply

Your email address will not be published. Required fields are marked *