Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

angular

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).

like image 671
BingeCode Avatar asked Aug 13 '21 14:08

BingeCode


1 Answers

  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).

like image 113
BingeCode Avatar answered Oct 03 '22 01:10

BingeCode