cranehuang
cranehuang

Reputation: 505

Unable to fetch platform android: Error: EACCES

First, I installed PhoneGap:

$ sudo npm install -g phonegap

Then I created a new project:

$ phonegap create hellophonegap

But when I ran the project:

$ phonegap run android

I get the following error:

[~/hellophonegap]$ phonegap run android  
[phonegap] executing 'cordova platform add android'...  
Unable to fetch platform android: Error: EACCES, mkdir '/home/crane/tmp/npm-28555-XalHvwaa'
[phonegap] executing 'cordova run android'...
No platforms added to this project. Please use 'cordova platform add platform'.

I have configured the Android SDK environment variables properly. This was added to my .bashrc:

export ANDROID_SDK=/home/crane/androidsdk
export PATH=$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools:$PATH`

I'm using Ubuntu 14.04, and running PhoneGap v4.1.2-0.22.9

Upvotes: 7

Views: 10504

Answers (4)

Aitzol Berasategi
Aitzol Berasategi

Reputation: 71

I solve th problem on Ubuntu 15.10 removing the folder /home/user/.cordova

sudo rm -r /home/user/.cordova

and running again -$ cordova platform add android

cordova platform add android

Upvotes: 5

Softmixt
Softmixt

Reputation: 1756

Okay, so your /home/ubuntu/tmp has wrong permissions. It happened because you did sudo npm install in the past, and npm doesn't handle this well enough.

Run sudo chown ubuntu /home/ubuntu/tmp -Rv to fix this issue, or just delete that folder.

Upvotes: 14

uday magdum
uday magdum

Reputation: 31

Unable to fetch platform android: Error: EACCES, mkdir '/home/crane/tmp/npm-28555-XalHvwaa'

For this answer use sudo front of your command

Upvotes: 3

AAhad
AAhad

Reputation: 2845

[phonegap] executing 'cordova run android'...
No platforms added to this project. Please use 'cordova platform add platform'.

means you have not added a platform at yet and are trying to execute it.

You have to do in following sequence:

First install phonegap via below command (which you have done already).

$ sudo npm install -g phonegap

then create a project

$ phonegap create hello com.example.hello HelloWorld

then go inside the newly created project directory

cd hello

Now add one or more platforms

$ phonegap platform add ios
$ phonegap platform add amazon-fireos
$ phonegap platform add android

once a platform has been added , now first build it then run it

to build:

$ phonegap build

and now to run on device:

$ phonegap run android

or to run on simulator

$ phonegap emulate android

Note :- You must have Java, Android and ANT paths set correctly.

Please refer this for more details: http://docs.phonegap.com/en/3.5.0/guide_cli_index.md.html

have a look on this as well. cordova build Command failed with exit code EACCES

Upvotes: 0

Related Questions