Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 567
cranehuang Avatar asked Nov 30 '14 08:11

cranehuang


2 Answers

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.

like image 86
Softmixt Avatar answered Nov 13 '22 07:11

Softmixt


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
like image 20
Aitzol Berasategi Avatar answered Nov 13 '22 08:11

Aitzol Berasategi