ng build --prod => Error: Unknown argument: prod

Viewed 8949

When I try to build my angular project in production environment: ng build --prod --aot the console returns this error: Error: Unknown argument: prod ng serve is working fine and ng build without parameters seems to work too. Why does angular return such an error?

Thanks in advance for your help

3 Answers

ng build --configuration production --aot can help.

The reason for this error is the command –prod is deprecated since Angular 12 and removed in Angular 14 based on this Angular-Deprecated APIs and features.

Use --configuration production instead.

I've deleted : package-lock.json

change: "heroku-postbuild": "ng build --prod" to "heroku-postbuild": "npm run build"

into package.json

Related