How to fix this Error: spawn EACCES

I’m getting tired of repeating this, but

DO NOT LISTEN TO PEOPLE TELLING YOU TO RUN IONIC COMMANDS AS ROOT

DO NOT LISTEN TO PEOPLE TELLING YOU TO BLINDLY SUBVERT FILESYSTEM FLAGS WITH chmod

6 Likes

Works like magic…thanks!

Awsomeness thanks very much! I paid someone for an app for my marketplace she pretty much sold me some stuff that is worthless it was suppose to be so easy i should have learned it myself. Now that I have it on the android app she said the login and register feature would work and it does not.

I still getting the EACCESS error .

cordova build android
:heavy_multiplication_x: Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

    ANDROID_HOME=/Users/xxxxx/Library/Android/sdk
    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
    Error: spawn EACCES

I already granted my project folder to 777, and it still not working.

Any idea?

Thanks.

For me the problem was solved after removing and adding the android platform.

cordova:

cordova platform remove android
cordova platform add android

ionic:

ionic cordova platform remove android
ionic cordova platform add android
2 Likes

That’s ! This worked for me!

I discovered the --verbose flag, when I ran the plugin add command with it, the log showed each command as it was executed, turned out gradle.bat and gradlew in ~/git/ionic/myApp/platforms/android weren’t executable, when I did a chmod a+x gradle* in that directory the cordova plugin add worked. Hope that helps

EDIT: I just realized that I posted in the wrong topic, sorry for the mistake, I’m new here

In 2017 having latest version and building for v1 use sudo chmod -R a+rwx /appfolder

Works great, thanks!

For me, it’s worked :slight_smile:

It “worked” in the same way using a megaton of TNT would “work” to kill a house fly, and would have about the same effect on the surrounding house. In other words, you have completely broken the execution permissions on your entire project and should start over with a newly generated one.

Please, people, stop following this horrible advice.

1 Like
ionic hooks add
[ERROR] Unable to find command: hooks add
2 Likes

I am getting the very same error. Did you find a solution?

I just removed and added android, no help. Still getting this…

@rapropos - What is a good solution for this problem then? I have it too, do not know how to solve it but I agree with you to not mess with the filesystem…

  • How can I determine the real cause for it?

I only see this output :slight_smile:

> ionic cordova prepare
> cordova prepare
✔ Running command - done!

> cordova build android
✖ Running command - failed!
[ERROR] An error occurred while running cordova build android (exit code 1):


        ANDROID_HOME=/Users/xxx/Library/Android/sdk
        JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home
        Error: spawn EACCES
3 Likes

One tool I find useful in situations like this is strace.

strace -f cordova build android > /tmp/buildlog 2>&1

…then examine /tmp/buildlog for things that look suspicious, especially open or exec calls failing with EPERM or EACCES. If you can find one, you may be able to identify the problematic file and what permission is missing.

1 Like

Any strace on mac?

port search strace
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
dnstracer @1.9 (net, sysutils)
    trace a chain of DNS servers to the source

Google says “dtruss” and “dtrace” are potential candidates.

Yeah, saw that too :smiley: Thanks

I had this encounter while I was try to build on Ionic pro cloud. I was able to resolve it by deleting the file hooks folder completely.

1 Like

None of these suggestions work for me. If anyone can help my info is here Error: spawn EACCES [ERROR] An error occurred while running cordova build ios (exit code 1) with jscrambler.js