Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

498
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda