Sunday, May 21, 2017

Cannot add platform using Cordova CLI 7.0.0

Leave a Comment

I updated my Cordova CLI from 6.5 to 7.0.0 using the command npm update -g cordova. I created a project( cordova create myApp com.myCompany.myApp myApp ). When I try to add Android to the project ( cordova platform add android ), i am getting the below error.

Error: Failed to fetch platform cordova-android@~6.2.2 Probably this is either a connection problem, or platform spec is incorrect. Check your connection and platform name/version/URL. Error: cmd: Command failed with exit code 1 Error output: 'C:\windows\system32\npm' is not recognized as an internal or external command, operable program or batch file. 

I also tried adding android with specific version which is available with CLI in my machine ( cordova platform add android@5.1.1 ) but results the same.

Is there any special way to add platform tot he project with Cordova 7.0.0. ?

1 Answers

Answers 1

I did some analysis on this and looks like its an issue with android SDK compatibility. Check for the version of Android provided by Cordova under C:/Users/%USER%/.cordova/lib/npm-cache/cordova-android (in case of windows OS) and install the respective android platform version provided.

For example: cordova platform add android@6.0.0

Hope it helps. Cheers

UPDATE: I guess Issue-CB-12767 should resolve your issue. --nofetch is the key

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment