Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

491
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda