Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

490
Views
An unhandled exception occurred: The 'buildOptimizer' option cannot be used without 'aot'

If you are getting the error An unhandled exception occurred: The 'buildOptimizer' option cannot be used without 'aot'. or some variation of that while using ng build or ng deploy, then here is the solution that worked for me (scroll down).

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

  1. Go into your angular.json file
  2. In that file, follow the path projects -> architect -> build -> options
  3. Change "buildOptimizer" to true and add "aot" to true as well

The above commands should work now.

ADDON: If you have that problem with ng serve or ng test, you could try replacing build in step 2 with serve or test respectively (Disclaimer: I have not tested that).

over 4 years ago · Santiago Trujillo Report

0

When I upgrade from angular 11 to angular 13 I see this error during command ng serve. To fix it I created a brand new angular project with the "@angular/cli" and imitate the angular.json of the new project.

inside angular.json projects>MY_PROJECT_NAME>architect>build>configurations added a development with json

"development": {
  "buildOptimizer": false,
  "optimization": false,
  "vendorChunk": true,
  "extractLicenses": false,
  "sourceMap": true,
  "namedChunks": true
}

under ...serve>configurations added

"development": {
  "browserTarget": "hasap:build:development"
}

under ...serve> added "defaultConfiguration": "development"

You can see the details of changes in angular.json from my commit https://github.com/canbax/hasap/commit/9c0fc95fc244d35b2d7ee70c7048f6b38bd213b5

over 4 years ago · Santiago Trujillo Report

0

I used the production configuration to serve my project

 ng serve -o --ssl true --configuration production

This will use the buildOptimizer and the aot issue.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!