【问题标题】:Cordova commands aren't recognized after installing ionic-cli-4安装 ionic-cli-4 后无法识别 Cordova 命令
【发布时间】:2019-01-03 10:45:59
【问题描述】:

在项目期间我想效仿(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) 同时,我已经降级了...:/

【问题讨论】:

  • 对我来说工作正常。你能仔细检查一下你是否在全球范围内安装了cordova?
  • 但它在以前的版本中对我有用,并且在我升级后,为什么无法正确安装 Cordova?

标签: cordova ionic-cli


【解决方案1】:

遇到了同样的问题。解决方法是全局安装 ionic CLI:

作为开发者用户,从您的 ionic 项目根目录执行以下操作:

npm uninstall ionic

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

npm i -g ionic@latest

之后,您应该可以使用新的 ionic CLI 4.0.1 版

【讨论】:

    【解决方案2】:

    我也面临同样的问题。

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

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

    【讨论】:

    • 是的,在发布这个问题后我已经降级了......一切正常 - 但我想跟上更新......如果我会被抛在后面这么久,东西会停止工作:/
    猜你喜欢
    • 2016-01-01
    • 2018-01-01
    • 2017-09-29
    • 2020-12-16
    • 2016-02-28
    • 2019-03-05
    • 1970-01-01
    • 2016-02-22
    相关资源
    最近更新 更多