I am trying to make my angular project production build but it fails with the following error: Error: Unknown argument: prod. In this Exerror article, We are going to learn about How to reproduce this error and we will discuss All Possible Solutions Let’s Get Start With This Article.
How Error: Unknown argument: prod While running ng build –prod Error Occurs?
I am trying to make my angular project production build but it fails with the following error:
Error: Unknown argument: prod
So here I am writing all the possible solutions that I have tried to resolve this error.
How To Solve Error: Unknown argument: prod While running ng build –prod Error?
Error: Unknown argument: prod While running ng build –prod
To Solve Error: Unknown argument: prod While running ng build –prod Error As I mentioned in Solution 1 That –prod command is Deprecated in Angular version 12 But still You can use –prod in Your Angular version 12 Cause This command is Only deprecated So You Can Downgrade Your Angular to Version 12. But In Angular version 14 –prod command is Removed So that you can’t use it anymore.
How To Solve Error: Unknown argument: prod While running ng build –prod Error?
To Solve Error: Unknown argument: prod While running ng build –prod Error If You are Using Angular 14 and you are trying to run the –prod command then from Angular 14 the command –prod is deprecated since Angular 12 and Removed in Angular 14 So That you cant use –prod command in Angular 14 To Solve Error: Unknown argument: prod While running ng build –prod Error You just need to replace –prod command with ng build –configuration production. From Angular 14 If You want to create a production build then Run this: ng build –configuration production For development, ng build –configuration development And now, Your error will be solved. Thank You.
Solution 1: Replace with –configuration production
If You are Using Angular 14 and you are trying to run the –prod command then from Angular 14 the command –prod is deprecated since Angular 12 and Removed in Angular 14 So That you cant use –prod command in Angular 14 To Solve Error: Unknown argument: prod While running ng build –prod Error You just need to replace –prod command with ng build –configuration production.
From Angular 14 If You want to create a production build then Run this.
ng build --configuration production
For development,
ng build --configuration development
And now, Your error will be solved. Thank You.
Solution 2: Downgrade Angular
As I mentioned in Solution 1 That –prod command is Deprecated in Angular version 12 But still You can use –prod in Your Angular version 12 Cause This command is Only deprecated So You Can Downgrade Your Angular to Version 12. But In Angular version 14 –prod command is Removed So that you can’t use it anymore.
Conclusion
It’s all About this error. I hope We Have solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you.
Also, Read
- You intended to execute a .NET SDK command: No .NET SDKs were found
- ZoneInfoNotFoundError: No time zone found with key
- Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16
- Caused by: org.gradle.api.InvalidUserCodeException: Build was configured to prefer settings repositories over project repositories but repository ‘maven’ was added by build file ‘build.gradle’
- mysql.connector.errors.ProgrammingError: Character set ‘utf8’ unsupported