Mark
Mark

Reputation: 5088

Unable to fetch platform android: Error: Failed to parse json

Im running cordova version 4.3.0.

Suddenly, cordova commands have stopped working. I can create a new project. But when I go run:

cordova platform add android

I get:

Unable to fetch platform android: Error: Failed to parse json
Unexpected end of input

When I run the command "android" in Git Bash, I get the error:

 sh.exe": android: command not found

The "android" command works in Command Line. I get the same error on Command Line when trying to add the android platform.

In my Environmental Variables, PATH includes the paths:

C:\Program Files (x86)\Android\android-sdk\tools;C:\Program Files (x86)\Android\android-sdk\platform-tools

Which are the correct paths to Android.

What could possibly be going on? Cordova has been working fine for months and then suddenly this..

Upvotes: 0

Views: 2416

Answers (1)

Mark
Mark

Reputation: 5088

This appears to have been a problem with the npm cache getting corrupted. I deleted the folder cordova-android at C:\Users\Mark\.cordova\lib\npm_cache\ then ran cordova platform add android again. Instead of using the cache, a new cordova-android is downloaded. Haven't had any problems since.

Upvotes: 2

Related Questions