Angular CLI – Fixing Unknown option: ‘–environment’

This post shows you how to solve “Unknown option: ‘–environment’” error when you are trying to build your Angular application with Angular CLI using the command like this:

ng build --environment=prod

You get the “Unknown option: ‘–environment'” error because you have installed angular/cli v6+ while the above command works in angular/cli 1.x only.

The solution is to use the new command as shown right below:

ng build --configuration=production


Learn more about How to build an Angular application in Production mode with Angular CLI