ios 无法运行离子平台命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43905962/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 09:07:17  来源:igfitidea点击:

Not able to run ionic platform commands

ioscordovaionic-framework

提问by Keshav Vasudevan

I want to get an ios build for my ionic app (v1 of the framework was used to ). Looking at documentation, it seems like I would have to run the following commands -

我想为我的 ionic 应用程序获取 ios 版本(框架的 v1 用于)。查看文档,似乎我必须运行以下命令 -

ionic platform add ios
ionic platform build ios

However, running this command gives me a message-

但是,运行此命令会给我一条消息-

The platform command has been renamed. To find out more, run:

  ionic cordova platform --help

Thinking that maybe there's been a new update that renamed the commands, I ran ionic cordova platform --help, to only get

考虑到可能有一个新的更新重命名了命令,我跑了ionic cordova platform --help,只得到

[ERROR] Unable to find command: cordova platform

   _             _
  (_)           (_)
   _  ___  _ __  _  ___
  | |/ _ \| '_ \| |/ __|
  | | (_) | | | | | (__
  |_|\___/|_| |_|_|\___|  CLI 3.0.0


  Usage:

    $ ionic <command> [arguments] [options]
    $ ionic <command> --help (for command details)

  Global Commands:

    docs ................ Open the Ionic documentation website
    info ................ Print system/environment info
    login ............... Login with your Ionic ID
    signup .............. Create an Ionic account
    start ............... Create a new project
    telemetry ........... Opt in and out of telemetry

  Project Commands:

    generate ............ Generate pipes, components, pages, directives, providers, and tabs (ionic-angular >= 3.0.0) (alias: g)
    link ................ Connect your local app to Ionic
    serve ............... Start a local development server for app dev/testing
    upload .............. Upload a new snapshot of your app
    package build ....... Start a package build
    package download .... Download your packaged app
    package info ........ Get info about a build
    package list ........ List your cloud builds

  Options:

    --verbose ........... Verbose output for debugging
    --help .............. Show help for provided command

I'm starting to think that it's some weird error with my machine only, as no one has so far reposted this on the web. I get the same messages when I try to run other ios commands like ionic build iosand ionic emulate ios

我开始认为这只是我的机器出现了一些奇怪的错误,因为到目前为止还没有人在网上重新发布过这个错误。我得到同样的消息时,我尝试运行像其他IOS命令ionic build iosionic emulate ios

Please advise me on how to generate a build so I can test the app in real ios devices.

请告诉我如何生成构建,以便我可以在真实的 ios 设备上测试应用程序。

回答by Keshav Vasudevan

Figured it out! The right command is

弄清楚了!正确的命令是

ionic cordova platform add ios 
ionic cordova build ios

回答by Rafa? Go?ubowicz

As seen in the documentation, you have simply forgotten to add cordovato the command:

正如文档中所见,您只是忘记添加cordova到命令中:

ionic cordova platform add ios
ionic cordova platform build ios

回答by Frank HN

First make sure you have installed cordova eg: if you are using a package manager like npm. hit:

首先确保你已经安装了cordova,例如:如果你使用的是像npm这样的包管理器。打:

npm install cordova -g

then:

然后:

  ionic cordova platform add android
  ionic cordova platform add ios

回答by Maniya Joe

I faced same issue while adding android device to ionic so followed below command and is working for me.

我在将 android 设备添加到 ionic 时遇到了同样的问题,所以按照下面的命令对我工作。

ionic cordova platform add android