安装ionic-cli-4后无法识别Cordova命令

时间:2018-07-26 12:24:20

标签: cordova ionic-cli

在项目期间,我想模仿(ionic cordova emulate ios,然后它问我(我通常说是):

? 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

之后,我尝试重新运行该命令,但是好像它不再识别命令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)

不确定到底想要什么,语法没有更改(仍然为ionic cordova $something) 同时,我降级了...:/

2 个答案:

答案 0 :(得分:9)

有同样的问题。解决方法是全局安装离子CLI:

开发者用户从您的离子项目根目录执行以下操作:

npm uninstall ionic

然后以“ root”用户身份执行以下操作:

npm i -g ionic@latest

在那之后,您应该能够使用新的离子CLI版本4.0.1

答案 1 :(得分:0)

我面临着同样的问题。

解决方法:降级到您的旧版本npm i -g ionic@3.20.0

在您的ionic cordova命令中添加--no-interactive参数以忽略更新问题