Click here to Skip to main content
15,881,577 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello every one,
I am developing an ionic application. At first my angular cli version is 9.0. When i run the command line"ionic cordova build android",it works.But now the angular cli update to 14.0.1.I try to run the command line"ionic cordova build android" then get error like "An error occurred while running subprocess ng."
The following is detailed error description:
"
ionic cordova build android
> ng.cmd run app:ionic-cordova-build --platform=android
Error: Unknown argument: platform
[ERROR] An error occurred while running subprocess ng.

ng.cmd run app:ionic-cordova-build --platform=android exited with exit code 1.

Re-running this command with the --verbose flag may provide more information.
"
PS:
ng version

_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/


Angular CLI: 14.0.1
Node: 16.13.0
Package Manager: npm 8.1.3
OS: win32 x64

Angular: 14.0.1


Is there any solution to solve this problem
Help will be appreciated.
Thank You

What I have tried:

I asked my colleague for help and searched relevant information online.But there are too little information about angular cli 14.
Posted
Updated 8-Jan-23 7:40am
v2

Error: Unknown argument: platform

You are (presumably) using incorrect options. Check the angular documentation to see what it should be.
 
Share this answer
 
Comments
Member 15676890 17-Jun-22 4:15am    
Could you please tell me more about the incorrect options. No options are provided during command operation.
Richard MacCutchan 17-Jun-22 4:58am    
Look at the messages produced:
> ng.cmd run app:ionic-cordova-build --platform=android
Error: Unknown argument: platform
[ERROR] An error occurred while running subprocess ng.
ng.cmd run app:ionic-cordova-build --platform=android exited with exit code 1.

It clearly shows ng.cmd is being called with the --platform=android option. As I said above, you need to check the angular documentation. This is not a programming problem that we can help with, it is purely something to do with the product(s) you are using.
Try these steps in order. Worked for me.

1.
ionic cordova platform rm android

2.
ionic cordova platform add android

3.
ionic cordova build android
 
Share this answer
 
If you run this command: ng add @ionic/cordova-builders it should add the required builders that are missing from the angular.json file generated by the Ionic CLI.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900