ionic-cli: Exception: Using cordova-fetch for cordova-ios@^4.5.0

Description: I updated ionic-cli to 3.12.0 and I started getting this error:

[ERROR] Exception: Using cordova-fetch for cordova-ios@^4.5.0

Steps to Reproduce:

  1. Update cordova-cli to 3.12.0 from 3.11.x
  2. Try running cordova ionic build ios

Output:

DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/andrewrodebaugh/aqua', local: true, binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', 
        libPath: '/Users/andrewrodebaugh/aqua/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 19777)
> cordova platform add ios --save
✖ Running command - failed!
[ERROR] Exception: Using cordova-fetch for cordova-ios@^4.5.0

        Error: Failed to fetch platform cordova-ios@^4.5.0
        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 1 Error output:
        npm ERR! Darwin 17.0.0
        npm ERR! argv "/usr/local/bin/node" "/Users/andrewrodebaugh/aqua/node_modules/.bin/npm" "install" 
        "cordova-ios@^4.5.0" "--save"
        npm ERR! node v6.11.3
        npm ERR! npm  v2.15.12
        npm ERR! code EPEERINVALID
        
        npm ERR! peerinvalid The package @angular/common@4.4.3 does not satisfy its siblings' peerDependencies 
        requirements!
        npm ERR! peerinvalid Peer @angular/forms@4.4.3 wants @angular/common@4.4.3
        npm ERR! peerinvalid Peer @angular/platform-browser@4.4.3 wants @angular/common@4.4.3
        npm ERR! peerinvalid Peer @angular/platform-browser-dynamic@4.4.3 wants @angular/common@4.4.3
        npm ERR! peerinvalid Peer @angular/platform-server@4.4.3 wants @angular/common@4.4.3
        npm ERR! peerinvalid Peer @angular/router@4.4.3 wants @angular/common@4.4.3
        npm ERR! peerinvalid Peer ionic-angular@3.6.1 wants @angular/common@4.1.3
        
        npm ERR! Please include the following file with any support request:
        npm ERR!     /Users/andrewrodebaugh/aqua/node_modules/npm-debug.log
       

My ionic info:

cli packages: (/Users/andrewrodebaugh/aqua/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 : 2.1.4
    Cordova Platforms  : browser 4.1.0 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.1

System:

    Node  : v6.11.3
    npm   : 2.15.12 
    OS    : macOS High Sierra
    Xcode : Xcode 9.0 Build version 9M137d 

Misc:

    backend : legacy

Other Information:

npm-debug.log https://gist.github.com/CosmicWebServices/d81ae61f49958dc9bc5b59ed9266d123

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 40 (9 by maintainers)

Most upvoted comments

@saarmic dis you tried what I suggested? update npm both globally and non globally:

npm install -g npm@latest and npm install npm@latest

I was stucked on that same problem during hours… I wasn’t able to download the cordova-ios as well. I (suppose to) had the last version of npm, but kept telling me that it was 2.15.12. Upgrading the both solved it for me.

Thanks guys, @felixja , @viki53, @FallenRiteMonk and @CosmicWebServices

npm install npm@4.1.2 --save-dev

did saved me, however I want to add a few observations: I had Cordova in my --dev dependencies, which is not required. As I am having Cordova in dev dependencies then for building the iOS platform the dev version of Cordova is used along with the .npm folder which is in the local node modules and not the global npm. which is the reason that even after npm install npm@latest -g was not working and instead the Cordova was using the local npm version which was 2.4.x

so the solution is:

  1. Remove Cordova from local dependencies.
  2. do npm install npm@4.1.2 --save-dev (optional, you can use your own global version of npm instead of 4.1.2)
  3. run ionic cordova platform add ios
  4. and then ionic cordova build ios --prod --release

Do these steps

  1. ionic cordova platform remove ios
  2. npm install ionic cordova -g
  3. npm uninstall npm
  4. npm uninstalll cordova
  5. ionic cordova platform add ios

This should get you past that issue. It stems from somehow npm and cordova getting installed locally, you want the global version, and the global version @latest

This isn’t because of the CLI update. These are npm errors. Please use the latest npm 3 or npm 5. npm 2 originates ~2014.

npm install npm -g

horrible bug - hours wasted. Ultimately to get around it I had to:

  1. completely delete my project
  2. run npm install ionic@latest cordova@latest -g and make sure I had the latest of all
  3. ionic start a new project with the latest package.json
  4. clone my repo from github again
  5. manually move over my package.json, plugins, and src files over to the new project

eventually I was able to get it built and running identically to the old one

@saarmic as far as I have tested removing cordova localy solved the problem: npm unistall cordova --save or --save-dev if you have it as dev dep. I havent tested it myself but also @felixja solution should do the trick, just also install npm locally: npm install npm --save-dev maybe even specify the same version as you have installed globaly: npm install npm@4.1.2 --save-dev

Hi all, I am completely lost here. I have tried every possible solution in this list … none has worked. I have had 2 days of banging my head against the wall with ionic and COUNTLESS errors and problems.

I got the app to build twice about 1 hour ago after running npm install cordova-fetch

I have changed nothing and now it’s back …

What I have tried …

  1. everything above

  2. reinstalling cordova

  3. reinstalling ionic + ionic cli

  4. changing node version

    @ionic/cli-utils : 1.12.0 ionic (Ionic CLI) : 3.12.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : ios 4.5.2
Ionic Framework    : ionic-angular 3.6.1

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.2
ios-sim           : 6.1.2
Node              : v6.11.3
npm               : 5.5.1
OS                : macOS Sierra
Xcode             : Xcode 8.3.3 Build version 8E3004b

Misc:

backend : pro

I think In my case was a remainder for the first time I was using npm and I didn’t have any idea of what the -g meant, so I think I installed it with and without it…

The real solution is this case I think should be something similar to remove npm locally and keep it just globally. But I didn’t try, Anyway it was difficult to found this solution as there was not much info on stackoverflow or here on github about this and I spent a lot of time searching why my npm version was always that 2.15.12. I hope this can bring light to more people, because for me it was not just causing the problem for downloading cordova-ios, I was having much more troubles that were solved after I was able to fix.

Weirdly enough, @felixja 's solution fixed the issue on my part.

Seems counter-intuitive to have npm installed locally though…

I had similar problems and for me it was related to having npm installed both globally and locally. When I updated npm I always did on the global because I didn’t even know I had it locally too, so for the project it kept using the 2.15 version and a lot of things were broken and giving problems.

Removing npm locally and installing globally, or specifically updating npm locally, solved my problems and everything worked like a charm since that.

Hope it helps

In my case this is some kind of problem with having cordova installed locally. To fix this just remove the locally install version of cordova and then it should work!

@dwieeb is cordova somehow specifying a version of npm since the log clearly states it uses a npm 2.x version while i have 5.x installed on my dev machine?