Ionic-cli: Failed to fetch platform cordova-ios@~4.5.4

Created on 6 Mar 2018  Â·  5Comments  Â·  Source: ionic-team/ionic-cli

Description:
I started building ios in mac pro but failed

Steps to Reproduce:

  1. running ionic cordova build ios

Output:
902labdeMacBook-Pro:902Scratch-ionic 902lab$ ionic cordova build ios

cordova platform add ios –save
Using cordova-fetch for cordova-ios@~4.5.4

(node:1253) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to fetch platform cordova-ios@~4.5.4
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:
Unhandled rejection RangeError: Maximum call stack size exceeded
at RegExp.test ()
at /usr/local/lib/node_modules/npm/node_modules/aproba/index.js:38:16
at Array.forEach ()
at module.exports (/usr/local/lib/node_modules/npm/node_modules/aproba/index.js:33:11)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:37:3)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
at flatNameFromTree (/usr/local/lib/node_modules/npm/lib/install/flatten-tree.js:39:14)
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/902lab/.npm/_logs/2018-03-05T07_14_42_840Z-debug.log
(node:1253) [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.

Running app-scripts build: –platform ios –target cordova
[15:14:45] build dev started …
[15:14:45] clean started …
[15:14:45] clean finished in 1 ms
[15:14:45] copy started …
[15:14:45] transpile started …
[15:14:48] transpile finished in 2.96 s
[15:14:48] preprocess started …
[15:14:48] deeplinks started …
[15:14:48] deeplinks finished in 5 ms
[15:14:48] preprocess finished in 5 ms
[15:14:48] webpack started …
[15:14:48] copy finished in 3.17 s
[15:14:56] webpack finished in 7.99 s
[15:14:56] sass started …
[15:14:57] sass finished in 993 ms
[15:14:57] postprocess started …
[15:14:57] removed unused font files
[15:14:57] postprocess finished in 9 ms
[15:14:57] lint started …
[15:14:57] build dev finished in 12.11 s

cordova build ios
(node:1270) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: No platforms added to this project. Please use cordova platform add .
(node:1270) [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.

[15:15:00] tslint: src/pages/chapter/chapter.ts, line: 2
‘IonicPage’ is declared but never used.

L1: import { Component } from '@angular/core';
L2: import { IonicPage, NavController, NavParams, ToastController } from 'ionic-angular';
L3: import { DomSanitizer } from '@angular/platform-browser';
[15:15:00] tslint: src/pages/lesson/lesson.ts, line: 9
‘jquery’ is declared but never used.

L8: import { Renderer2, ElementRef } from '@angular/core';
L9: declare var jquery:any;
L10: declare var $ :any;
[15:15:00] tslint: src/pages/lesson/lesson.ts, line: 36
Property ‘sanitize’ is declared but never used.

L35: constructor(public navCtrl: NavController, public navParams: NavParams,
L36: public http: Http, private sanitize:DomSanitizer,
L37: private renderer: Renderer2, private el: ElementRef) {
[15:15:00] tslint: src/pages/lesson/lesson.ts, line: 37
Property ‘renderer’ is declared but never used.

L36: public http: Http, private sanitize:DomSanitizer,
L37: private renderer: Renderer2, private el: ElementRef) {
L38: this.lesson_segment = "introduction";
[15:15:00] tslint: src/pages/lesson/lesson.ts, line: 37
Property ‘el’ is declared but never used.

L36: public http: Http, private sanitize:DomSanitizer,
L37: private renderer: Renderer2, private el: ElementRef) {
L38: this.lesson_segment = "introduction";
[15:15:00] tslint: src/pages/lesson/lesson.ts, line: 66
‘doc’ is declared but never used.

L65: $("#iframe").load(function() {
L66: var doc = this.contentDocument || this.contentWindow.document;
L67: var target = $("p");
[15:15:00] tslint: src/pages/lesson/lesson.ts, line: 2
‘IonicPage’ is declared but never used.

L1: import { Component } from '@angular/core';
L2: import { IonicPage, NavController, NavParams } from 'ionic-angular';
L3: import {Http} from '@angular/http';
[15:15:00] tslint: src/pages/course/course.ts, line: 3
All imports are unused.

L2: import {NavController} from 'ionic-angular';
L3: import { NgIf } from '@angular/common';
L4: import {Http, Headers} from '@angular/http';
[15:15:00] tslint: src/pages/about-detail/about-detail.ts, line: 2
‘IonicPage’ is declared but never used.

L1: import { Component } from '@angular/core';
L2: import { IonicPage, NavController, NavParams } from 'ionic-angular';
[15:15:00] tslint: src/pages/signup/signup.ts, line: 1
‘NgModule’ is declared but never used.

L1: import { Component, NgModule } from '@angular/core';
L2: import { IonicPage, NavController, NavParams } from 'ionic-angular';
[15:15:00] tslint: src/pages/login/login.ts, line: 2
‘IonicPage’ is declared but never used.

L1: import { Component } from '@angular/core';
L2: import { IonicPage, NavController, NavParams } from 'ionic-angular';
L3: import {Validators, FormBuilder,FormGroup } from '@angular/forms';
[15:15:00] tslint: src/pages/login/login.ts, line: 7
All imports are unused.

L6: import { Storage } from '@ionic/storage';
L7: import { Events } from 'ionic-angular';
L8: import {SignupPage} from "../signup/signup";
[15:15:00] tslint: src/components/tree-view/tree-view.ts, line: 1
‘forwardRef’ is declared but never used.

L1: import { Component, forwardRef, Input } from '@angular/core';
[15:15:00] tslint: src/pages/product-detail/product-detail.ts, line: 2
‘IonicPage’ is declared but never used.

L1: import {Component} from '@angular/core';
L2: import {IonicPage, NavController, NavParams, PopoverController} from 'ionic-angular';
L3: import {DomSanitizer} from '@angular/platform-browser';
[15:15:00] tslint: src/pages/product-detail/product-detail.ts, line: 8
All imports are unused.

L7: import {PersonalCenterPage} from "../personal-center/personal-center";
L8: import {TreeViewComponent} from "../../components/tree-view/tree-view";
[15:15:00] tslint: src/pages/my/my.ts, line: 2
‘Events’ is declared but never used.

L1: import { Component } from '@angular/core';
L2: import { NavController, Events } from 'ionic-angular';
L3: import {LoginPage} from "../login/login";
[15:15:00] tslint: src/pages/my/my.ts, line: 4
All imports are unused.

L3: import {LoginPage} from "../login/login";
L4: import { Storage } from '@ionic/storage';
L5: import {AboutDetailPage} from "../about-detail/about-detail";
[15:15:00] tslint: src/pages/my/my.ts, line: 5
All imports are unused.

L4: import { Storage } from '@ionic/storage';
L5: import {AboutDetailPage} from "../about-detail/about-detail";
L6: import { NgIf } from '@angular/common';
[15:15:00] tslint: src/pages/my/my.ts, line: 6
All imports are unused.

L5: import {AboutDetailPage} from "../about-detail/about-detail";
L6: import { NgIf } from '@angular/common';
L7: import {AuthService} from "../../service/AuthService";
[15:15:00] tslint: src/pages/products-list-view/products-list-view.ts, line: 47
Property ‘popoverCtrl’ is declared but never used.

L46: orderType: string = "time-Order";
L47: or(public navCtrl: NavController, public http:Http, private popoverCtrl: PopoverController, public navParams
L48: public settingService: SettingService, public toastCtrl: ToastController) {
[15:15:00] tslint: src/pages/products-list-view/products-list-view.ts, line: 2
‘IonicPage’ is declared but never used.

L1: import { Component } from '@angular/core';
L2: import { IonicPage, NavController, PopoverController, NavParams, ToastController } from 'ionic-angular';
L3: import {Http} from '@angular/http';
[15:15:00] tslint: src/pages/products-list-view/products-list-view.ts, line: 8
All imports are unused.

L7: import {SettingService} from "../../service/SettingService";
L8: import { NgIf } from '@angular/common';
[15:15:00] tslint: src/app/app.module.ts, line: 35
All imports are unused.

L34: import {PersonalCenterPage} from "../pages/personal-center/personal-center";
L35: import {TreeViewComponent} from "../components/tree-view/tree-view";
[15:15:00] tslint: src/pages/favorite/favorite.module.ts, line: 4
All imports are unused.

L3: import { FavoritePage } from './favorite';
L4: import { ItemSliding } from 'ionic-angular';

My ionic info:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:

cordova (Cordova CLI) : 8.0.0
local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms : none
Ionic Framework : ionic-angular 3.6.1
System:

Node : v8.9.4
npm : 5.7.1
OS : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b
Environment Variables:

ANDROID_HOME : not set
Misc:

backend : pro

Other Information:

Most helpful comment

@dwieeb I had the same error but I actually never use Mac. I made the mistake of cloning and installing everything using sudo. When I started over without using a single sudo, everything went smoothly. Thanks!

All 5 comments

@pengcongfa Adding the ios platform failed. That's why you get this message: CordovaError: No platforms added to this project.

Try this:

rm -rf platforms/ plugins/
cordova platform add ios

and then run ionic cordova build ios again.

If you need additional support, please see our Support Page for general Ionic support questions. This repo is reserved for bug reports and feature requests of the Ionic CLI.

@dwieeb
I did as you suggested, but it stuck and doesn't work
how to solve this situation. thank you

output

902labdeMacBook-Pro:~ 902lab$ cd Desktop/test/902Scratch-ionic/
902labdeMacBook-Pro:902Scratch-ionic 902lab$ rm -rf platforms/ plugins/
902labdeMacBook-Pro:902Scratch-ionic 902lab$ cordova platform add ios
Using cordova-fetch for cordova-ios@~4.5.4

Same here. I have upgraded node, did rm -rf platforms/ plugins/, have the Google and OpenDNS as DNS servers, but nothing.
LE: Tried with a mobile network hotspot, and still nothing - the error persists.

Silviu:learning-ionic-plugins silviu$ ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2 
    ios-sim           : 5.1.0 
    Node              : v9.10.1
    npm               : 5.8.0 
    OS                : macOS High Sierra
    Xcode             : Xcode 9.3 Build version 9E145 

Environment Variables:

    ANDROID_HOME : /Users/silviu/Library/Android/sdk

Misc:

    backend : pro


Silviu:learning-ionic-plugins silviu$ cordova platform add ios
Using cordova-fetch for [email protected]
(node:21572) 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.
Error: npm: Command failed with exit code 254 Error output:
npm WARN checkPermissions Missing write access to /Users/silviu/IonicProjects/learning-ionic-plugins/node_modules/cordova-plugin-boottime
npm ERR! path /Users/silviu/IonicProjects/learning-ionic-plugins/node_modules/cordova-plugin-boottime
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access '/Users/silviu/IonicProjects/learning-ionic-plugins/node_modules/cordova-plugin-boottime'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/silviu/.npm/_logs/2018-04-06T15_21_07_076Z-debug.log
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/platform/addHelper.js:312:25
    at _rejected (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:797:24)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:823:30
    at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:808:41)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13)
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:112:11)
(node:21572) 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:21572) [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.
Silviu:learning-ionic-plugins silviu$ 

@s1lviu I'm not sure how that error relates to the original issue, but please see the following line in your error message:

npm WARN checkPermissions Missing write access to /Users/silviu/IonicProjects/learning-ionic-plugins/node_modules/cordova-plugin-boottime

Your directory permissions appear incorrect.

@dwieeb I had the same error but I actually never use Mac. I made the mistake of cloning and installing everything using sudo. When I started over without using a single sudo, everything went smoothly. Thanks!

Was this page helpful?
0 / 5 - 0 ratings