1
votes

Following error is generating while running this command,unable to build apk.

$ ionic cordova platform add android

cordova platform add android --save Using cordova-fetch for cordova-android@~6.3.0

Error: Failed to fetch platform cordova-android@~6.3.0 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: The filename, directory name, or volume label syntax is incorrect. The filename, directory name, or volume label syntax is incorrect. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

2
Ionic info cli packages: (C:\Users\Sahil\AppData\Roaming\npm\node_modules) @ionic/cli-utils : 1.18.0 ionic (Ionic CLI) : 3.18.0 global packages: cordova (Cordova CLI) : 7.1.0 local packages: @ionic/app-scripts : 3.1.2 Cordova Platforms : none Ionic Framework : ionic-angular 3.9.2 System: Node : v8.9.0 npm : 5.5.1 OS : Windows 10 Environment Variables: ANDROID_HOME : C:\Program Files\Android1\Android Studio\bin Misc: backend : proSahil
Are you running the command on the right directory?Jose Rojas

2 Answers

0
votes

Quick Fix -

DELETE the downloaded file cordova-android-6.2.3.tgz or folder npm-304 8-83f48a6f under- C:\Users**{userName}**\AppData\Local\Temp\npm-304 8-83f48a6f\registry.npmjs.org\cordova-android-\cordova-android-6.2.3.tgz

And do cordova platform add android again. npm will redownload the required file. You can also download it manually (7.7 MB) from here and place it in the same folder and then run the command.

or delete all the files in the temp folder add the downloaded file in the root folder of C:\Users**{userName}**\AppData\Local\Temp\cordova-android-6.2.3.tgz

Worked For Me

0
votes

i was try this and fix this problem ... remove cordova and then install cordova using

 npm install -g cordova

if this not work then remove nodemodules and install nodemodules using

 npm install