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 [email protected]
) but results the same.
Is there any special way to add platform tot he project with Cordova 7.0.0. ?
The cordova plugin add command requires you to specify the repository for the plugin code. Please note that when you follow the Web Project Dev workflow and use the CLI, the CLI will take care of adding the plugin code to the appropriate place for each platform.
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 [email protected]
Hope it helps. Cheers
UPDATE: I guess Issue-CB-12767 should resolve your issue. --nofetch
is the key
Running the following command in my project directory fixed the problem for me:
npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With