keshinpoint
keshinpoint

Reputation: 1001

Not able to run ionic platform commands

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.

Upvotes: 18

Views: 24896

Answers (4)

Frank HN
Frank HN

Reputation: 535

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

npm install cordova -g

then:

  ionic cordova platform add android
  ionic cordova platform add ios

Upvotes: 1

Rafał Gołubowicz
Rafał Gołubowicz

Reputation: 660

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

ionic cordova platform add ios
ionic cordova platform build ios

Upvotes: 4

Maniya Joe
Maniya Joe

Reputation: 801

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

ionic cordova platform add android

Upvotes: 1

keshinpoint
keshinpoint

Reputation: 1001

Figured it out! The right command is

ionic cordova platform add ios 
ionic cordova build ios

Upvotes: 35

Related Questions