Yesterday: Upgrade All the Things! Today: What Have I Done?


#1

tl;dr: I can build and run iOS, but not Android


I recently upgraded Cordova to to version 4.3

This gave me some iOS headaches, so I tried to update xcode. Of course, this meant that I had to stop putting off my upgrade to Yosemite.

So for good measure, I upgraded my CLI and am now using Ionic v1.0.0-rc.5.

after all of these installs, I run ionic build android and it yields

running cordova build android
Running command: /project/hooks/after_prepare/010_add_platform_class.js /project
add to body class: platform-android
Running command: /project/platforms/android/cordova/build

events.js:72
throw er; // Unhandled ‘error’ event
^
Error: spawn EACCES
at errnoException (child_process.js:998:11)
at Process.ChildProcess._handle.onexit (child_process.js:789:34)
ERROR building one of the platforms: Error: /project/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /project/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/share/npm/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)



I don't expect anyone to be able to recreate since it is clearly a machine-specific thing, but any/all suggestions are very much appreciated.

#2

that EACCES suggests that it is a file permission issue, but I get no results when I run find . ! -user pmn


#3

additionally, sudo ionic build android gives the same result


#4

I’ve had this error before, I think this is what fixed it:

chmod 755 hooks/after_prepare/*


#5

thanks for the response @ashteya. Unfortunately for me, that’s not it. You can see in the console output that I get past the hooks but fail somewhere in the build command.

I opened the build file and added a bunch of console.log statements to see if I could debug it, but I’m a little lost in the node world and had no luck.


#6

I think the permissions issue might be on build command instead.

From your ionic project directory try:

chmod 755 platforms/android/cordova/build

#7

thank you for the suggestion @bmwilson74, but the file is already 755, and I am confident that it is running because I edited the script by putting in a bunch of console.log statements which did print to the stdout. super frustrating.

I know this is outside the scope of ionic at this point, but if anyone has any suggestions, I am all-ears.

as an aside, I saw that ionic cli had an update today. I execute the npm statement to update it, but it errored-out, so I sudo ran it, and it succeeded. does that give any clues?


#8

Maybe try removing the platform, then running the following

ionic hooks add
ionic platform add android

It may be related to this issue

I know you aren’t trying to add it, but it’s worth a shot.


#9

Thanks for the suggestions everyone. I finally got things working by sudo uninstalling cordova, and then non-sudo installing it again. It took several tries to install (npm issues, I guess), and I had to upgrade my android sdk, but android is building once again