Ionic 6 cordova platform problem with angular 14

Viewed 557

I got the error when i was running the app on the browser .

ionic cordova run browser

The error was

Error: Unknown argument: platform [ERROR] An error occurred while running subprocess ng.   ng.cmd run app:ionic-cordova-build --platform=browser exited with exit code 1. Re-running this command with the --verbose flag may provide more information.

My Configs

Ionic:

Ionic CLI : 6.13.1 Ionic Framework : @ionic/angular 6.1.13 @angular-devkit/build-angular : 14.0.5 @angular-devkit/schematics : 14.0.5 @angular/cli : 14.0.5 @ionic/angular-toolkit : 6.1.0

Cordova:

Cordova CLI : 11.0.0 Cordova Platforms : browser 6.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 4 other plugins)

Utility:

cordova-res : 0.15.4 native-run : 1.6.0

System:

Android SDK Tools : 26.1.1 NodeJS : v16.16.0 npm : 8.2.0 OS : Windows 10

2 Answers

I found the solution the thing which i was missing was

ng add @ionic/cordova-builders

It is a collection of builders for @ionic/angular projects using Cordova.

This solution also works for android and ios

This error happen beacause you don't did the migration of an application in Angular to Ionic, the solution is simple.

Run

npm install @ionic/angular@6

If you are using Ionic Angular Server, be sure to update that as well:

npm install @ionic/angular@6 @ionic/angular-server@6

However if that's code don't run try this code:

npm install @ionic/angular@latest @ionic/angular-toolkit@latest --save

if need read the documentation of the migration:

https://ionicframework.com/docs/reference/migration

I hope than help you

Related