Search code examples
angularnpmionic4yarnpkgcapacitor

cant complete ionic capacitor add android command


I am trying to add android as a supported platform to my project by running the command: ionic capacitor add android.

The command is executed and stops at a prompt which asks me "which npm client would you like to use ? (use arrow keys), with yarn being the only option.

The problem is I am stuck at this point and pressing the arrow keys do not register anything (the keys work fine) and I cant even select the only option I am given

So far I have tried: uninstalling yarn creating new project deleting the node_modules updating all modules

Nothing seems to work. On the plus side though when I attempted to do these steps on another machine it all worked well and I never got the prompt, which makes it unique to only my main workstation. I am still trying to figure out why I get the problem on this specific machine


Solution

  • It's a bug on the ionic CLI. It's been fixed, but not released yet. https://github.com/ionic-team/capacitor/issues/1453

    As workaround you can remove the --capacitor option when creating the project, and then do the integration manually like this:

    npm install @capacitor/core @capacitor/cli

    npx cap init

    And let Ionic know you did the integration by adding this to the ionic.config.json

    "integrations": {
        "capacitor": {}
    },