Can't run the platform command

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 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

[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 ios and ionic emulate ios

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

try
ionic cordova platform add ios
ionic cordova build ios

2 Likes

Thanks a lot! This works! I really appreciate the answer!

You seem to be missing the Ionic CLI cordova plugin in this output here. Can you post your ionic info for this project please?

Hi Sujan, this is what I get

global packages:

    @ionic/cli-utils : 1.0.0
    Cordova CLI      : 7.0.0 
    Ionic CLI        : 3.0.0

local packages:

    @ionic/cli-plugin-cordova : 1.0.0
    @ionic/cli-plugin-ionic1  : 1.0.0
    Ionic Framework           : unknown

System:

    Node       : v7.10.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.2 Build version 8E2002 
    ios-deploy : not installed
    ios-sim    : 5.0.13

Please advise. Thanks!

Did [quote=“mobgg, post:2, topic:89741”]
ionic cordova platform add ios
ionic cordova build ios
[/quote] work for you now or didn’t it?

Post your package.json content please if not.

cordova platform add android
cordova platform remove android

or
cordova platform add android
ionic platform remove android

cordova platform add android

cordova platform rm android

works for me

Using the cordova commands directly may work, but will omit building before copying the files to the platform. There is a reason why Ionic CLI offers these wrappers for Cordova CLI and doesn’t just advise you to use it directly.

A post was split to a new topic: An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=163):