Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to fetch platform cordova-android@~6.2.2 #2412

Closed
jgw96 opened this issue Jun 9, 2017 · 52 comments
Closed

Failed to fetch platform cordova-android@~6.2.2 #2412

jgw96 opened this issue Jun 9, 2017 · 52 comments

Comments

@jgw96
Copy link
Contributor

jgw96 commented Jun 9, 2017

From @iamkhan001 on June 9, 2017 7:20

getting error while adding android platform

D:\Imran\ionic\notifications>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-framework#11989

@jgw96
Copy link
Contributor Author

jgw96 commented Jun 9, 2017

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?

@imhoffd imhoffd changed the title Cordova encountered an error. You may get more insight by running the Cordova command above directly. Failed to fetch platform cordova-android@~6.2.2 Jun 9, 2017
@toddmedema
Copy link

I'm getting something similar:

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: 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   'cordova-android@6.2.2',
1 verbose cli   '--save' ]
2 info using npm@5.0.3
3 info using node@v8.1.2
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 cordova-android@6.2.2 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" "cordova-android@6.2.2" "--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 ]

@toddmedema
Copy link

Downgraded from Node 8 to Node 6 (as suggested here: katzer/cordova-plugin-local-notifications#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.

@marcelodeandrade
Copy link

@toddmedema Thank you for the information.

@pkitatta
Copy link

pkitatta commented Jul 17, 2017

Hi,
What was the solution here?

@dwieeb @jgw96 What effect does the proxy have and how do you go around it?

@hadijahangiri
Copy link

i have this error plz help me

@madsongr
Copy link

madsongr commented Aug 6, 2017

@hadijahangiri Try setting path = "C:\Windows\System32" in variable/system variable

@satyanarayanapalli
Copy link

add this line in your environment varible in path
C:\Windows\System32
its working now

@musasesay
Copy link

× Running command - failed!
[ERROR] Exception: Using cordova-fetch for cordova-android@~6.2.2

@ghost
Copy link

ghost commented Aug 18, 2017

screen shot 2017-08-19 at 2 26 34 am

@ghost
Copy link

ghost commented Aug 18, 2017

screen shot 2017-08-19 at 2 29 31 am

@ghost
Copy link

ghost commented Aug 18, 2017

How to fix it ?

@madsongr
Copy link

@Jumong you must open windows environment variables and add to path = "C:\Windows\System32" in system variables

@musasesay
Copy link

musasesay commented Aug 19, 2017 via email

@ghost
Copy link

ghost commented Aug 19, 2017

@madsongr my os osX

@jln1989
Copy link

jln1989 commented Aug 22, 2017

Am having the same issue now and adding "C:\Windows\System32" 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.2

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 5.1.1
Ionic Framework    : ionic-angular 3.6.0

System:

Node : v6.11.0
npm  : 3.10.10
OS   : Windows 10

@Daym3l
Copy link

Daym3l commented Aug 22, 2017

i have the same error..
I add C:\Windows\System32, but the same error

@madsongr
Copy link

@jln1989 @Daym3l did you try to open windows cmd again? Every change on system environment variables requires to close cmd and open it again.

@madsongr
Copy link

@jln1989 is it working now?

@Daym3l
Copy link

Daym3l commented Aug 24, 2017

@madsongr yes thank you

@Ivan-Perez
Copy link

Ivan-Perez commented Aug 25, 2017

I downgraded npm to version 3.10.0 and it worked again. Previously I had npm 5.4.0.

@xydxdy
Copy link

xydxdy commented Aug 29, 2017

I have C:\Windows\System32 already, but I still have this problem.
ps. npm vsersion 3.10.10 and node version 6.11.0

@Daym3l
Copy link

Daym3l commented Aug 29, 2017

@topphon try update to node 8.4.0, work for me...

@VovanSuper
Copy link

Well, generally adding System32 folder to path helps; also somehow only powershell running as administartor resolves different EPERM issues (when building Ionic 3 apps)

@madsongr
Copy link

@topphon follow the steps from this link http://ionicframework.com/docs/v1/guide/installation.html and pay attention on red links for windows/linux

@jln1989
Copy link

jln1989 commented Aug 30, 2017

@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.

@luckylooke
Copy link

luckylooke commented Sep 6, 2017

For me it was a typo.. andorid instead of android 🤦‍♂️

@crlang44
Copy link

I had this same issue, adding the C:\Windows\System32 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.

@JayanthkumarJK
Copy link

Same issue i am encontering in Linux system how to solve this...???

@crlang44
Copy link

crlang44 commented Sep 14, 2017

@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

@f4bio
Copy link

f4bio commented Sep 26, 2017

work-around at silimar issue (#2538)

@TomohikoTsuji
Copy link

TomohikoTsuji commented Oct 5, 2017

Try install old version.
①npm uninstall -g cordova
②npm install -g cordova@6.5.0
③cordova platform add android

@rahadur
Copy link

rahadur commented Oct 6, 2017

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 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! 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 ...`

@ThalesMatoso
Copy link

I also have this error, some solution? I've tried everything above, and I'm a linux user.

@Alb93
Copy link

Alb93 commented Oct 7, 2017

@TomohikoTsuji solution worked for me.
I'm running on Win10

@foongpon
Copy link

foongpon commented Oct 7, 2017

@TomohikoTsuji solution worked for me too.

@im7srar
Copy link

im7srar commented Oct 9, 2017

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 .

@foongpon
Copy link

foongpon commented Oct 9, 2017

As @TomohikoTsuji stated, just use the below commands. That worked for me

npm uninstall -g cordova
npm install –g cordova@6.5.0 or npm install –g cordova@latest
ionic cordova platform add android

@armmmo
Copy link

armmmo commented Oct 13, 2017

adding the PATH helped me..thanks

@jqzhao
Copy link

jqzhao commented Oct 17, 2017

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.

@capitalgerald
Copy link

##Here is the Solution that help me.
@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%\System32\Wbem;C:\Windows\System32;

Then close the current cmd and open a new cmd

Visit this Link - That helped me

@suraj1212
Copy link

hey @madsongr i tried your method but whenever i am setting my path variable to C:\Windows\System32
i am getting another msg like "node is not recognized as an internal or external command"
Guys i nedd help...

@madsongr
Copy link

@suraj1212 probably you don't have node installed globally.

@lexyfeito
Copy link

So i installed OpenSSH and it erased my whole PATH, adding C:\Windows\System32 to the PATH fixed it

@phoenixsachin
Copy link

C:\Windows\System32 this is awesome . add to system variable in path.

@Kreedzt
Copy link

Kreedzt commented Jul 5, 2018

After those steps, i cleaned the dir at C:\Users\${username}\.config\configstore.
So that worked.

@blakcoder2017
Copy link

This worked for me:
npm cache clean -f

@ionic4themes
Copy link

I added C:\Windows\System32 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 typescript@2.6.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/compiler-cli@5.1.3 wants typescript@>=2.4.2 <2.6
npm ERR! peerinvalid Peer @angular/tsc-wrapped@4.4.6 wants typescript@^2.1.5
npm ERR! peerinvalid Peer tsickle@0.21.6 wants typescript@^2.1.0
npm ERR! peerinvalid Peer tsutils@2.15.0 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 tslint@5.8.0 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.

@alienfractal
Copy link

Anyone solved this for Linux or iOS ?

@rubencougil
Copy link

rubencougil commented Nov 7, 2018

I am having the same problem for all platforms:


   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 browser@5.0.4 --save
Using cordova-fetch for cordova-browser@5.0.4
(node:4172) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch platform cordova-browser@5.0.4
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.````

@nebi19
Copy link

nebi19 commented Jan 21, 2019

10q sir it works

@oyepez003
Copy link

Try removing the package-lock.json and reinstall with npm install --cache /tmp/empty-cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests