cordovaionic-cli

Cordova commands aren't recognized after installing ionic-cli-4


during project I wanted to emulate ( ionic cordova emulate ios ) then it asked me ( and I usually say yes ):

? The Ionic CLI (local version) has an update available (3.20.0 => 4.0.1)! Would you like to install it? Yes
> npm i -D -E ionic@latest
āœ” Running command - done!

[OK] Updated Ionic CLI to 4.0.1! šŸŽ‰

Please re-run your command.

Note: You can downgrade to your old version by running: npm i --save -E ionic@3.20.0

after that I tried to re-run the command, but it's like it no longer recognize the command ionic cordova emulate ios:

[ERROR] Unable to find command: /usr/local/bin/node /Users/$ME/.npm-packages/bin/ionic cordova emulate ios

   _             _
  (_) ___  _ __ (_) ___
  | |/ _ \| '_ \| |/ __|
  | | (_) | | | | | (__
  |_|\___/|_| |_|_|\___|  CLI PRO 4.0.1


  Usage:

    $ ionic <command> [<args>] [--help] [--verbose] [--quiet] [--no-interactive] [--no-color] [--confirm] [options]

  Global Commands:
   ...
  Project Commands:

    build .................... Build web assets and prepare your app for any platform targets
    cordova <subcommand> ..... Cordova functionality (subcommands: build, compile, emulate, platform, plugin, prepare,
                               requirements, resources, run)
    doctor <subcommand> ...... Commands for checking the health of your Ionic project (subcommands: check, list, treat)
    generate ................. Automatically create framework features (alias: g)
    git <subcommand> ......... Commands relating to git (subcommands: remote)
    integrations <subcommand>  Manage various integrations in your app (subcommands: disable, enable, list)
    link ..................... Connect local apps to Ionic Pro
    monitoring <subcommand> .. Commands relating to Ionic Pro error monitoring (subcommands: syncmaps)
    serve .................... Start a local dev server for app dev/testing (alias: s)
    ssl <subcommand> ......... (experimental) Commands for managing SSL keys & certificates (subcommands: generate)

Not sure what the hell it wants, the syntax hasn't changed ( still ionic cordova $something ) Meanwhile, i've downgraded... :/


Solution

  • Had the same problem. The fix is to install ionic CLI globally:

    As the developer user execute the following from your ionic project root directory:

    npm uninstall ionic
    

    then as user "root" execute the following:

    npm i -g ionic@latest
    

    after that, you should be able to use the new ionic CLI version 4.0.1