15

I am trying to learn ionic cross platform tool. i have setup thing required for example application ionic serve is working fine but when i try to run sudo ionic build android or sudo ionic run/emulate android it returns with error message.

Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1162:11)
    at Object.exports.spawn (child_process.js:995:9)
    at Object.exports.spawn (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:103:31)
    at runScriptViaChildProcessSpawn (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:189:23)
    at runScript (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:132:16)
    at /usr/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:115:20
    at _fulfilled (/usr/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/lib/node_modules/cordova/node_modules/q/q.js:749:13)

i am unable to understand what does its mean. i have google this thing but after appling all of those solutions i got same error. i ll highly thankful if any one can tell me what is going wrong with me.

7 Answers 7

34

The issue is with the command 010_add_platform_class.js missing execute permission.

You could use chmod +x hooks/after_prepare/010_add_platform_class.js to give execute permission.

I found this solution on the Ionic framework forum at the below link. http://forum.ionicframework.com/t/how-to-fix-this-error-spawn-eacces/20490/6

Sign up to request clarification or add additional context in comments.

1 Comment

This "grant permission" command does not work for me, I'm still getting the error.
4

Successfully Worked

chmod +x hooks/after_prepare/010_add_platform_class.js

1 Comment

This answer is a rehash of @bkowshik's Aug 31 2015 answer (most upvoted).
4

First try to give execution permission to one file in hooks folder (010_add_platform_class.js), you can use this command:

chmod +x hooks/after_prepare/010_add_platform_class.js

If it does not work, change the permissions of complete files in sdk folder by:

chmod +x -R /home/username/Android/Sdk

If you are installed gradle in separate, give permission to that folder also:

chmod +x -R /home/username/Android/gradle-2.3

Comments

3

You can try ionic hooks add if other fix have not worked

Comments

2

While the given solution did take me a step further, adding execute permissions to android sdk was also needed.

chmod +x -R /home/username/Android/Sdk

see Error: spawn EACCES when trying to build Ionic app in Ubuntu 15.10

1 Comment

Yuck - make the entire sdk executable including config files, the README file etc. Maybe restrict this to the shell scripts>!>!>! This solution did work for me, however, by just making the gradlew script executable
2

I tried this, it's working

      chmod +x hooks/after_prepare/010_add_platform_class.js

Comments

-1

Try running this in your app folder :

  • ionic hooks add

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.