How to fix Failed to fetch platform cordova-ios@~4.4.0

15,364

Solution 1

I have resolved this, it appears to be an NPM issue and not a Cordova one. I just updated NPM within Terminal and after the update "cordova platform add ios" worked fine. Happy days - 1 !

npm update -g

Solution 2

  1. Delete the folder cordova-ios, located in node_modules/cordova-ios.

  2. Type the following command

    ionic cordova build ios
    

Solution 3

Sometimes a previously added Platform is not removed Properly, so this type of issue occurs. Remove the platform by command and add it again..

Follow this steps:

  1. Run the command

     ionic cordova platform remove ios
    
  2. Run the command:

     ionic cordova platform add ios --save
    
  3. If you are still getting the issue, try running again:

     ionic cordova platform remove ios --save
    

NOTE: By running again the command ionic cordova platform remove ios --save fetches newer version of ios platform.
For example:

  • First time: cordova-fetch for cordova-ios@~4.5.1
  • Second time: cordova-fetch for cordova-ios@~4.5.4
Share:
15,364

Related videos on Youtube

Beloudest
Author by

Beloudest

Game Developer / Programmer / Web Developer / Music & Audio Production / Marketing / Analytics My game development skills are as follows: LUA, Corona SDK, Javascript, PHP, MYSQL, CSS3, HTML5, Wordpress, JQuery, C#, JAVA, Objective C, Unity 5, 3D Modelling, Texturing, Compositing, Maya, C4D, Substance Painter, Substance Designer, Terragen Cloud Infrastructure Design, Rackspace, AWS, Database Design/Management, Server Configuration, API Design/Implementation I can adequately make my way round Photoshop/Illustrator/AfterEffects to edit images, do touch ups, prepare media, edit/create videos, and create UI assets etc. Design is the field I never seem to have enough time for... I create my own music on occasions and I can master audio to a very good standard.

Updated on September 14, 2022

Comments

  • Beloudest
    Beloudest over 1 year

    When I use the "cordova platform add ios" command for the latest Cordova version which is 7.0.1, I receive a failed to fetch message.

    I am trying to upgrade an existing project to iOS version 4.4.0 but for my peace of mind, I tried creating a fresh project which also had the same error.

    Here is my terminal output below showing the errors I receive, can anyone recommend a solution to resolve this issue?

    Stuarts-MacBook-Pro:T Stu$ cordova create myApp org.apache.cordova.myApp myApp
    Creating a new cordova project.
    Stuarts-MacBook-Pro:T Stu$ cd myApp
    Stuarts-MacBook-Pro:myApp Stu$ cordova platform add ios
    Using cordova-fetch for cordova-ios@~4.4.0
    Error: Failed to fetch platform cordova-ios@~4.4.0
    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
    Stuarts-MacBook-Pro:myApp Stu$ cordova platform add ios
    Using cordova-fetch for cordova-ios@^4.4.0
    Error: Failed to fetch platform cordova-ios@^4.4.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 254 Error output:
    npm WARN [email protected] No repository field.
    npm ERR! Darwin 16.0.0
    npm ERR! argv "/usr/local/Cellar/node/6.2.0/bin/node" "/usr/local/bin/npm" "install" "cordova-ios@^4.4.0" "--save"
    npm ERR! node v6.2.0
    npm ERR! npm  v3.8.9
    npm ERR! path /Users/S/Development/T/myApp/node_modules/.staging/xml-escape-d330e1e1
    npm ERR! code ENOENT
    npm ERR! errno -2
    npm ERR! syscall rename
    
    npm ERR! enoent ENOENT: no such file or directory, rename '/Users/S/Development/T/myApp/node_modules/.staging/xml-escape-d330e1e1' -> '/Users/S/Development/T/myApp/node_modules/cordova-ios/node_modules/xml-escape'
    
  • Mark
    Mark over 6 years
    Nice try but no cigar