Skip to content

Ionic Repair command errors out during "ionic cordova prepare --no-build" step #3912

Description

@dotNetkow

Description:
ionic repair errors out after the final command it runs, "ionic cordova prepare --no-build", with message:

[WARN] No platforms added to this project. Cannot prepare native platforms
without any installed.

   Run ionic cordova platform add <platform> to add native platforms.

Note that on its own, "cordova prepare" works as expected, adding the native platforms back in.

Steps to Reproduce:
Create a new Ionic 4 app:
ionic start tabs tabs

Add the "iOS" Cordova:
ionic cordova platform add ios

Attempt to repair the project:
ionic repair

Everything works as expected, except for the iOS platform code being added back.

Output:
ionic repair:

[INFO] ionic repair will do the following:

   - Remove node_modules/ and package-lock.json
   - Run npm i to restore dependencies
   - Remove platforms/ and plugins/
   - Run cordova prepare to restore platforms and plugins

? Continue? Yes

✔ Removing ./package-lock.json - done!
✔ Removing ./node_modules - done!

npm i
[ snip ]
added 1226 packages from 1092 contributors and audited 53217 packages in 26.415s
found 1 low severity vulnerability
run npm audit fix to fix them, or npm audit for details
✔ Removing ./platforms - done!
✔ Removing ./plugins - done!
ionic cordova prepare --no-build
[WARN] No platforms added to this project. Cannot prepare native platforms
without any installed.

   Run ionic cordova platform add <platform> to add native platforms.

My ionic info:

ionic (Ionic CLI) : 4.12.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.1.1
@angular-devkit/build-angular : 0.13.6
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.6
@ionic/angular-toolkit : 1.4.0

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)

System:

Android SDK Tools : 26.1.1 (/Users/matt/Library/Android/sdk)
ios-deploy : 1.9.4
ios-sim : 7.0.0
NodeJS : v10.13.0 (/usr/local/bin/node)
npm : 6.7.0
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61

Other Information:
On its own, "cordova prepare" works as expected, adding the native platforms back in. Hinting that this is an issue with the Ionic CLI (and "ionic cordova prepare" specifically).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions