Hi, I just found interesting problem on Windows, when I tried to run
ionic cordova platform add android
I encountered error like this:
[
INFO] Enabling Cordova integration.
> ionic config set integrations.cordova {} --json --force
[OK] integrations.cordova set to {} in .\ionic.config.json!
> cordova platform add android --save
× Running command - failed!
[ERROR] Exception: Using cordova-fetch for cordova-android@~6.2.2
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.ionic.starter
Name: MyApp
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android@6.2.3
Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project
Installing "cordova-plugin-device" for android
Adding cordova-plugin-device to package.json
Saved plugin info for "cordova-plugin-device" to config.xml
Discovered plugin "cordova-plugin-ionic-webview" in config.xml. Adding it to the project
Installing "cordova-plugin-ionic-webview" for android
Adding cordova-plugin-ionic-webview to package.json
Saved plugin info for "cordova-plugin-ionic-webview" to config.xml
Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project
Installing "cordova-plugin-splashscreen" for android
Adding cordova-plugin-splashscreen to package.json
Saved plugin info for "cordova-plugin-splashscreen" to config.xml
Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project
Failed to restore plugin "cordova-plugin-statusbar" from config.xml. You might need to try adding it again.
Error: Failed to fetch plugin cordova-plugin-statusbar@https://github.com/apache/cordova-plugin-statusbar.git
via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm ERR! git clone
C:\Users\Teerasej\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\Teerasej\AppData\Local\Temp\npm-9880-9f262878\git-cache-80e59b63\fff289c0b8a7d0eb5b94f06d8ace9733054185bd:
Cloning into
'C:\Users\Teerasej\AppData\Local\Temp\npm-9880-9f262878\git-cache-80e59b63\fff289c0b8a7d0eb5b94f06d8ace9733054185bd'...
npm ERR! git clone
C:\Users\Teerasej\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\Teerasej\AppData\Local\Temp\npm-9880-9f262878\git-cache-80e59b63\fff289c0b8a7d0eb5b94f06d8ace9733054185bd:
error: cannot spawn sh: No such file or directory
npm ERR! git clone
C:\Users\Teerasej\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\Teerasej\AppData\Local\Temp\npm-9880-9f262878\git-cache-80e59b63\fff289c0b8a7d0eb5b94f06d8ace9733054185bd:
fatal: unable to fork
npm ERR! git clone
C:\Users\Teerasej\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\Teerasej\AppData\Local\Temp\npm-9880-9f262878\git-cache-80e59b63\fff289c0b8a7d0eb5b94f06d8ace9733054185bd:
npm ERR! code 128
npm ERR! Command failed: git -c core.longpaths=true clone
C:\Users\Teerasej\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\Teerasej\AppData\Local\Temp\npm-9880-9f262878\git-cache-80e59b63\fff289c0b8a7d0eb5b94f06d8ace9733054185bd
npm ERR! Cloning into
'C:\Users\Teerasej\AppData\Local\Temp\npm-9880-9f262878\git-cache-80e59b63\fff289c0b8a7d0eb5b94f06d8ace9733054185bd'...
npm ERR! error: cannot spawn sh: No such file or directory
npm ERR! fatal: unable to fork
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Teerasej\AppData\Roaming\npm-cache\_logs\2017-10-09T07_07_45_121Z-debug.log
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a
previous platform version, you do *not* need this plugin since the whitelist will be built in.
Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
Discovered plugin "ionic-plugin-keyboard" in config.xml. Adding it to the project
Installing "ionic-plugin-keyboard" for android
Adding ionic-plugin-keyboard to package.json
Saved plugin info for "ionic-plugin-keyboard" to config.xml
--save flag or autosave detected
Saving android@~6.2.3 into config.xml file ...
Internet Connection?
First, I guess it is about the internet connection. So I switch to new network, tried, and failed again. then I tried to new one, and failed again.
But in same network, same place, on MacOS. The addition just worked.
So I move to next.
Git?
I doubt that problem caused from Git version, currently is 2.14.2.window.1. But when I tried 2.13 and 2.0, all is 64-bit.
It’s still failed.
On the other hand, MacOS with git version 2.13.5 (Apple Git-94) just works.
What is real problem?
I remind that few weeks ago, with the same version of Git, same network. Everything still work.
Now I wonder what causes the problem? Git server? Cordova Registry?
FYI:
- I tried to install the plugin with
ionic cordova plugin
add, but still failed - I used fresh created Ionic Project from
ionic start
command (Oct 9, 2017)
Ionic Info on MacOS that works
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.0.0
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.7.1
System:
Android SDK Tools : 25.2.3
ios-deploy : 1.9.1
ios-sim : 6.0.0
Node : v6.9.2
npm : 3.10.9
OS : macOS Sierra
Xcode : Xcode 9.0 Build version 9A235
Misc:
backend : pro
Ionic Info on Windows (Problem found here)
cli packages: (C:\Users\Teerasej\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.0.0
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.7.1
System:
Android SDK Tools : 25.2.5
Node : v6.11.0
npm : 4.6.1
OS : Windows 10
Misc:
backend : legacy