Can't add Android platform and build project anymore?

So I wanted to start a new ionic project by writing:
ionic start Ionic1 blank

After that I moved to that new directory and wanted to add android platform:
ionic platform add android

I then got this error:

Error: Failed to fetch platform android
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: EACCES: permission denied, open ‘/home/think/.cordova/lib/npm_cache/cordova-android/4.1.1/package/.npmignore’

I don’t know why this happens. I tried these:

  1. change the permision with
    chmod 744 /home/think/.cordova/lib/npm_cache/cordova-android/4.1.1/package/.npmignore

  2. deinstalled and installed nodejs, cordova, ionic, etc.

  3. Executed with sudo ionic platform add android (but “sudo” is not necessary i think since I added android platform before in other projects without having to write “sudo” )

Still it’s somehow not possible to add a platform

Do you have android SDK manager installed? I assume you are on a mac (sudo) so check this tutorial on how to setup a mac for android:

I’m on ubuntu 14.04 LTS. I have android SDK manager installed.

I can build and run my other ionic projects that I created earlier. But since yesterday I can’t build new projects anymore. It happened when I iupdated to ionic 1.7.13

Hi,

As they say in compu-land, “have you tried turning it of and on again??”

try:

sudo npm install-g ionic sudo npm install-g cordova

and afterwards
ionic platform add android

If you create this project as root. You must continue as root permission.

  1. Delete your project (as root )
  2. Create new project not as root

Maybe this is a cache problem of cordova. Delete the cache and try to add the platform again:

rm -rf ~/.cordova