_From @iamkhan001 on June 9, 2017 7:20_
getting error while adding android platform
D:Imranionicnotifications>ionic cordova platform add android
cordova platform add android --save
? Running command - failed!
[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova platform add android --save (exi
t code 1):
    Using cordova-fetch for cordova-android@~6.2.2
    Error: Failed to fetch platform cordova-android@~6.2.2
    Probably this is either a connection problem, or platform spec is incorr
ect.
        Check your connection and platform name/version/URL.
        Error: cmd: Command failed with exit code ENOENT
_Copied from original issue: ionic-team/ionic#11989_
_From @piotrowski on June 9, 2017 8:37_
As the error message says:
Probably this is either a connection problem
...
Check your connection
Are you behind a corporate proxy?
I'm getting something similar:
Error: Failed to fetch platform [email protected]
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 194 Error output:
npm ERR! path /Users/todd/code/expedition-app/node_modules/es6-promise-plugin/package.json
npm ERR! code ELOOP
npm ERR! errno -62
npm ERR! syscall open
npm ERR! ELOOP: too many symbolic links encountered, open '/Users/todd/code/expedition-app/node_modules/es6-promise-plugin/package.json'
The NPM log file:
0 info it worked if it ends with ok
1 verbose cli [ '/Users/todd/.nvm/versions/node/v8.1.2/bin/node',
1 verbose cli   '/Users/todd/.nvm/versions/node/v8.1.2/bin/npm',
1 verbose cli   'install',
1 verbose cli   '[email protected]',
1 verbose cli   '--save' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session f287ac4f152a5ee4
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/cordova-android 19ms (from cache)
8 silly pacote version manifest for [email protected] fetched in 63ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 silly install loadShrinkwrap
12 silly fetchPackageMetaData error for es6-promise-plugin@file:node_modules/es6-promise-plugin ELOOP: too many symbolic links encountered, open '/Users/todd/code/expedition-app/node_modules/es6-promise-plugin/package.json'
13 verbose stack Error: ELOOP: too many symbolic links encountered, open '/Users/todd/code/expedition-app/node_modules/es6-promise-plugin/package.json'
14 verbose cwd /Users/todd/code/expedition-app/node_modules
15 verbose Darwin 16.6.0
16 verbose argv "/Users/todd/.nvm/versions/node/v8.1.2/bin/node" "/Users/todd/.nvm/versions/node/v8.1.2/bin/npm" "install" "[email protected]" "--save"
17 verbose node v8.1.2
18 verbose npm  v5.0.3
19 error path /Users/todd/code/expedition-app/node_modules/es6-promise-plugin/package.json
20 error code ELOOP
21 error errno -62
22 error syscall open
23 error ELOOP: too many symbolic links encountered, open '/Users/todd/code/expedition-app/node_modules/es6-promise-plugin/package.json'
24 verbose exit [ -62, true ]
Downgraded from Node 8 to Node 6 (as suggested here: https://github.com/katzer/cordova-plugin-local-notifications/issues/1329) and cordova was able to add android. Still ran into some difficulties with old plugins whose repos lacked package.json files, so had to hunt down forks of those plugins that're maintained / have a package.json file.
@toddmedema Thank you for the information.
Hi,
What was the solution here?
@dwieeb @jgw96 What effect does the proxy have and how do you go around it?
i have this error plz help me
@hadijahangiri Try setting path = "C:WindowsSystem32" in variable/system variable
add this line in your environment varible in path
C:WindowsSystem32
its working now
× Running command - failed!
[ERROR] Exception: Using cordova-fetch for cordova-android@~6.2.2


How to fix it ?
@jumong you must open windows environment variables and add to path = "C:WindowsSystem32" in system variables
ok thanks
On Sat, Aug 19, 2017 at 8:51 AM, madsongr notifications@github.com wrote:
@jumong https://github.com/jumong you must open windows environment
variables and add to path = "C:WindowsSystem32" in system variables—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/ionic-team/ionic-cli/issues/2412#issuecomment-323489270,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AYOO8OLPFKLXs5p-J-D9inHb5ickLAthks5sZjF9gaJpZM4N1a12
.
@madsongr my os osX
Am having the same issue now and adding "C:WindowsSystem32" did not resolve my issue. Any help here would be great.
My Ionic Info command returns the below:
@ionic/cli-utils : 1.9.2 ionic (Ionic CLI) : 3.9.2global packages:
Cordova CLI : 7.0.1local packages:
@ionic/app-scripts : 2.1.3 Cordova Platforms : android 5.1.1 Ionic Framework : ionic-angular 3.6.0System:
Node : v6.11.0 npm : 3.10.10 OS : Windows 10
i have the same error..
I add C:WindowsSystem32, but the same error
@jln1989 @Daym3l did you try to open windows cmd again? Every change on system environment variables requires to close cmd and open it again.
@jln1989 is it working now?
@madsongr yes thank you
I downgraded npm to version 3.10.0 and it worked again. Previously I had npm 5.4.0.
I have C:WindowsSystem32 already, but I still have this problem.
ps. npm vsersion 3.10.10 and node version 6.11.0
@topphon try update to node 8.4.0, work for me...
Well, generally adding System32 folder to path helps; also somehow only powershell running as administartor resolves different EPERM issues (when building Ionic 3 apps)
@topphon follow the steps from this link http://ionicframework.com/docs/v1/guide/installation.html and pay attention on red links for windows/linux
@madsongr : Apologies for not getting back early. My issue got resolved yesterday after reinstalling NPM and running the CMD as administrator. Thanks for the help.
For me it was a typo.. andorid instead of android 🤦♂️
I had this same issue, adding the C:WindowsSystem32 did not work for me, and I was already running it as admin. I finally got it to work but downgrading my npm to 3.10.0.
Same issue i am encontering in Linux system how to solve this...???
@JayanthkumarJK what version of node and npm are you running? May have to upgrade node to 8.4.0 like @Daym3l or downgrade npm to something like 3.10.0 like I did
work-around at silimar issue (#2538)
Try install old version.
①npm uninstall -g cordova
②npm install -g [email protected]
③cordova platform add android
Today i am getting this ERROR, try every possible solution above mentioned but did not working.
`× 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 [email protected]
    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! Error while executing:
    npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t https://github.com/apache/cordova-plugin-statusbar.git
    npm ERR!
    npm ERR! fatal: Unable to find remote helper for 'https'
    npm ERR!
    npm ERR! exited with error code: 128
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Rahadur\AppData\Roaming\npm-cache\_logs\2017-10-06T11_51_14_477Z-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
    Failed to restore plugin "ionic-plugin-keyboard" from config.xml. You might need to try adding it again. Error:
    Failed to fetch plugin ionic-plugin-keyboard@~2.2.1 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 4294963248 Error output:
    npm ERR! path C:\apps\notes\node_modules\fsevents\node_modules
    npm ERR! code EPERM
    npm ERR! errno -4048
    npm ERR! syscall scandir
    npm ERR! Error: EPERM: operation not permitted, scandir 'C:\apps\notes\node_modules\fsevents\node_modules'
    npm ERR!  { Error: EPERM: operation not permitted, scandir 'C:\apps\notes\node_modules\fsevents\node_modules'
    npm ERR!   stack: 'Error: EPERM: operation not permitted, scandir
    \'C:\\apps\\notes\\node_modules\\fsevents\\node_modules\'',
    npm ERR!   errno: -4048,
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'scandir',
    npm ERR!   path: 'C:\\apps\\notes\\node_modules\\fsevents\\node_modules' }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Rahadur\AppData\Roaming\npm-cache\_logs\2017-10-06T11_52_06_760Z-debug.log
    --save flag or autosave detected
    Saving android@~6.2.3 into config.xml file ...`
I also have this error, some solution? I've tried everything above, and I'm a linux user.
@TomohikoTsuji solution worked for me.
I'm running on Win10
@TomohikoTsuji solution worked for me too.
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 ENOENT
I have the above problem please help me if anyone knows , thanks .
As @TomohikoTsuji stated, just use the below commands. That worked for me
npm uninstall -g cordova
npm install –g [email protected] or npm install –g cordova@latest
ionic cordova platform add android
adding the PATH helped me..thanks
I wasn't able to add both cordova-ios@^4.4.0 and cordova-android@^6.2.3. Tried to ran 'npm update' before 'ionic cordova prepare', which updated the version of cordova-ios and cordova-androi and fixed the platform fetch issue.
@jgw96 @jumong
If you are in Windows usually this kind of error happens when you don't have all the paths required in your system environment path variable .
Especially the path variables given bellow.
Please paste this line on your system environment Path variable:
%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;C:WindowsSystem32;
Then close the current cmd and open a new cmd
hey @madsongr  i tried your method but whenever i am setting my path variable to  C:WindowsSystem32
i am getting another msg like "node is not recognized as an internal or external command"
Guys i nedd help...
@suraj1212 probably you don't have node installed globally.
So i installed OpenSSH and it erased my whole PATH, adding C:WindowsSystem32 to the PATH fixed it
C:WindowsSystem32 this is awesome . add to system variable in path.
After those steps, i cleaned the dir at C:\Users\${username}\.config\configstore.
So that worked.
This worked for me:
npm cache clean -f
I added C:WindowsSystem32 to system variables and clean the directory as @Kreedzt said, but still the same error, please help:
> cordova platform add android --save
Using cordova-fetch for cordova-android@~7.1.1
Failed to fetch platform cordova-android@~7.1.1
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:
npm ERR! Windows_NT 10.0.17134
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\PROYECTOS\\hs\\node_modules\\npm\\bin\\npm-cli.js" "install" "cordova-android@~7.1.1" "--production" "--save-exact"
npm ERR! node v8.11.3
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/[email protected] wants typescript@>=2.4.2 <2.6
npm ERR! peerinvalid Peer @angular/[email protected] wants typescript@^2.1.5
npm ERR! peerinvalid Peer [email protected] wants typescript@^2.1.0
npm ERR! peerinvalid Peer [email protected] wants typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >= 2.4.0-dev || >= 2.5.0-dev || >= 2.6.0-dev || >= 2.7.0-dev || >= 2.8.0-dev
npm ERR! peerinvalid Peer [email protected] wants typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev
npm ERR! Please include the following file with any support request:
npm ERR!     C:\PROYECTOS\hs\npm-debug.log
[ERROR] An error occurred while running subprocess cordova.
        cordova platform add android --save exited with exit code 1.
        Re-running this command with the --verbose flag may provide more information.
Anyone solved this for Linux or iOS ?
I am having the same problem for all platforms:
```Ionic:
ionic (Ionic CLI)  : 4.0.5 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0, browser 5.0.4, ios 4.5.5
System:
NodeJS : v8.11.3 (/usr/local/bin/node)
   npm    : 5.6.0
   OS     : macOS High Sierra
   Xcode  : Xcode 10.0 Build version 10A255
Environment:
ANDROID_HOME : not set
```
cordova platform add [email protected] --save
Using cordova-fetch for [email protected]
(node:4172) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch platform [email protected]
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Failed to get absolute path to installed module
at /home/travis/.nvm/versions/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/platform/addHelper.js:312:25
at _rejected (/home/travis/.nvm/versions/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:797:24)
at /home/travis/.nvm/versions/node/v8.11.3/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:823:30
at Promise.when (/home/travis/.nvm/versions/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
at Promise.promise.promiseDispatch (/home/travis/.nvm/versions/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:808:41)
at /home/travis/.nvm/versions/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:624:44
at runSingle (/home/travis/.nvm/versions/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:137:13)
at flush (/home/travis/.nvm/versions/node/v8.11.3/lib/node_modules/cordova/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:4172) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4172) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.````
10q sir it works
Try removing the package-lock.json and reinstall with npm install --cache /tmp/empty-cache
Most helpful comment
Try install old version.
①npm uninstall -g cordova
②npm install -g [email protected]
③cordova platform add android