Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova : Command failed with exit code EACCES

When i'm executing "cordova platform add android" the command return this :

Error: /Users/brieuc/.cordova/lib/android/cordova/3.6.4/bin/create: Command failed with exit code EACCES at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23) at ChildProcess.emit (events.js:95:17) at Process.ChildProcess._handle.onexit (child_process.js:818:12)

I've read that it could be a problem of permission so i've tried to use "sudo cordova platform add android" but the same error is returned.

I also tried to use chmod 777 on my project folder and platforms folder.

I tried to remove the platforms folder, the folder is recreated then same error is returned.

For your information, the commands "java", "ant", "cordova", "npm" are all recognize.

My only guess is that my Path to the SDK is wrong.

Here what i've done :

(I'm on Mac Yosemite for the information)

I downloaded the Standalone SDK tools.

I created a folder /Development/Android and added the unzipped downloaded folder (android-sdk-macosx).

For your information the "platforms" folder is empty.

i added to the /etc/paths the path to /Development/Android/android-sdk-macosx/tools

I'm not sure it should be here, any hints or solutions would be appreciated.

like image 702
Brieuc Avatar asked Jan 04 '15 10:01

Brieuc


2 Answers

I don't think the problem is on your project. The problem seems to be in

/Users/brieuc/.cordova/lib/android/cordova/3.6.4/bin/create

which doesn't have the necessary rights to be executed. Try to apply something like this command for that folder

chmod -R 777 /Users/brieuc/.cordova/lib/android/cordova/3.6.4/bin

It should give it all rights and thus let create to be executed.

like image 147
Roope Hakulinen Avatar answered Nov 15 '22 23:11

Roope Hakulinen


@Brieuc Here is solution for your new problem.

You need to specify Android SDK Path in .profile file located in your home.

In terminal,

sudo nano ~/.profile

Then add these lines at the end, save and close .profile. (You may have different paths for your Android SDK and ANT. ANT Path may not be necessary to set for you right now)

export ANT_HOME=/usr/share/ant
export ANDROID_HOME=/home/sagun/bin/android-sdk
export PATH=$PATH:$ANT_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Now at the terminal, you must notify the OS about the changes you made to .profile

source ~/.profile

If that doesn't do it, restart linux

Now, you may still face some permission issues, for that navigate to your android-sdk/tools and then enter

chmod +x android

Hope this helps you :)

like image 27
yuva Avatar answered Nov 16 '22 01:11

yuva