0

I'm trying to get the Android platform working on Cordova, but I'm running into what seems to be a permissions problem.

kevin@CM-Ubuntu-Main:~/workspace/HelloCordova$ cordova platform add android
Error: EACCES, open '/home/kevin/.cordova/lib/npm_cache/cordova-android/3.6.4/package/.npmignore'

I know that a lot of people who seem to have the same problem fixed it by adding the Android SDK to their PATH variable. I tried that and it doesn't seem to be working. I can run "android" straight from the terminal and use the Update Manager, but Cordova still doesn't seem to recognize it.

Here are some of my environment variables, in case something looks off.

kevin@CM-Ubuntu-Main:~/workspace/HelloCordova$ printenv
ANDROID_HOME=/home/kevin/.android-sdk-linux/sdk/tools
PATH=
    /usr/local/heroku/bin:
    /home/kevin/bin:
    /usr/lib/lightdm/lightdm:
    /usr/local/sbin:
    /usr/local/bin:
    /usr/sbin:
    /usr/bin:
    /sbin:
    /bin:
    /usr/games:
    /home/kevin/.android-sdk-linux/sdk/tools:
    /home/kevin/.android-sdk-linux/sdk/platform-tools
PWD=/home/kevin/workspace/HelloCordova
JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
HOME=/home/kevin

I saw that some other users have found it was a permissions problem, so I tried using sudo chown -R $(whoami) to fix my ~/.npm and node-modules folders, but that didn't help, either. I finally tried reinstalling Node.js, npm, and Cordova globally using this guide so that can everything is accessible to both user and root, and that seems to be working for everything else that uses Node. I can build the browser target in Cordova, as well, so the problem is probably with Android, but I can't figure out what to do next.

Here are the software versions I'm using:

Ubuntu 12.04
node 0.10.26
npm 1.4.3
cordova 4.2.0
Android APIs 21, 20, 19, 18, and 10 
Community
  • 1
  • 1
  • Try to delete the `.cordova` file/directory in your `/home/kevin/` directory and do the process of reinstalling cordova all over again. – frank Jan 30 '15 at 19:36
  • Sounds like an Android permissions issue. Installing the Android SDK and changing the owner is one thing, but after you start downloading packages, they may have different owners or permissions. Take a look at this script I made for Ubuntu. Read it over and see if there is something missing in your process. https://blog.nraboy.com/2014/09/install-android-cordova-ionic-framework-ubuntu/ – Nic Raboy Jan 30 '15 at 23:57
  • I ended up reinstalling Cordova, but the permissions were still set up wrong. I ran `chown` on my `.cordova` folder to be sure and it seems to have fixed it. I'll repost this as an answer in a minute. – Mr.Underhill89 Jan 31 '15 at 02:14

1 Answers1

1

I ended up reinstalling Cordova, but the permissions were still set up wrong. Running chown on the offending folders (e.g. /home/kevin/.cordova/lib/npm_cache/cordova-android/3.6.4/package/) to make sure the user owns it instead of root seems to have fixed it.