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

ionic repair does not properly re-add Cordova platforms in last step #4013

Closed
bryplano opened this issue Jun 7, 2019 · 1 comment
Closed
Labels
bug cordova Ionic projects integrated with Cordova

Comments

@bryplano
Copy link

bryplano commented Jun 7, 2019

Description:

When using the ionic repair command on a project which has previously had Cordova platforms added to it, everything works until the very last step (when the command attempts to re-add the platforms with cordova prepare). The end result is that Cordova platforms are not automatically added back to the project and need to be manually added again by running ionic cordova platform add <platform>.

Steps to Reproduce:

  1. Start a new Ionic project using ionic start CordovaApp blank
  2. cd to the project directory after the app is created
  3. (Optional) To ensure a built www directory is included, run ionic build
  4. Add cordova-android and/or cordova-ios to your project using one or both of the following commands:
  • ionic cordova platform add android
  • ionic cordova platform add ios
  1. The platforms are added to your project
  2. Run ionic repair
  3. Notice that the final step of the repair command fails to re-add your platforms

Output:

Screen Shot 2019-06-07 at 8 06 58 AM

My ionic info:

Ionic:

   Ionic CLI                     : 5.0.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.4.2
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

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

Utility:

   cordova-res : not installed
   native-run  : 0.2.3

System:

   Android SDK Tools : 26.1.1 (/Users/bryantplano/Library/Android/sdk)
   ios-deploy        : 2.0.0
   ios-sim           : 8.0.1
   NodeJS            : v10.16.0 (/usr/local/bin/node)
   npm               : 6.9.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001

Other Information:

Previously mentioned that this commit might fix the issue, but that doesn't appear to be the case: d9e1ced

It looks like package.json and config.xml both have references to the platforms, but they aren't checked by the CLI. Could be a quick fix, just need to check for the platforms in one (or either) of those files?

config.xml

    <platform name="android">
...
    </platform>
    <platform name="ios">

package.json

    "cordova-android": "8.0.0",
    "cordova-ios": "5.0.1",
@ionitron-bot ionitron-bot bot added the triage label Jun 7, 2019
@imhoffd
Copy link
Contributor

imhoffd commented Jun 7, 2019

This is because Cordova 9 no longer manages platform & plugin versions in config.xml, only package.json. The fix will require reading and preferring package.json as the source of "which platforms are installed".

@imhoffd imhoffd added bug cordova Ionic projects integrated with Cordova and removed triage labels Jun 7, 2019
@imhoffd imhoffd added this to Backlog 🤖 in Tooling 🔧 via automation Jun 7, 2019
Tooling 🔧 automation moved this from Backlog 🤖 to Done 🎉 Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cordova Ionic projects integrated with Cordova
Projects
Tooling 🔧
  
Done 🎉
Development

No branches or pull requests

2 participants