angularionic-frameworkionic6ng

Cannot run ionic angular app in browser using the ionic serve command


I am trying to run my first ionic angular app in a browser to see if I had installed ionic 6 properly on my computer. But I get this error message when using the ionic serve command. I included a reference link to the article that I am following: Running the Ionic app.

ng.cmd run app:serve --host=localhost --port=8100 [ng] Error: Unknown arguments: host, port

[ERROR] ng has unexpectedly closed (exit code 1).

The Ionic CLI will exit. Please check any output above for error details.

I am hoping to see some message that tells me that my test angular app is running with the ionic 6 framework. Sorry, I'm new to this so my question might sound confusing. I would really appreciate the help!


Solution

  • I don't know if you follow the tutorial that you referenced from the begenning, but in the previous step "set up the development environment", it's mentionned to install ionic with :

    npm install -g ionic
    

    But for Ionic starting version 6 and after, this is not the same package. Check in the official documentation "How to install the Ionic CLI".

    So you have to run :

    npm uninstall -g ionic
    npm install -g @ionic/cli
    

    Hope this will solve your problem.