Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 5 production build throwing error

I have an angular app using version 5.2 which is throwing the following error when building for production (does not throw the error when running the app locally or running a standard build.)

ERROR in Either route or analyzedModules has to be specified!

Upon research the error is thrown by the ahead of time compiler but I'm not sure what could be causing it, if anyone has suggestions of where to look that would be greatly appreciated.

Edit: As requested here is the error stack
ng build --prod

Date: 2018-05-17T10:23:10.379Z Hash: a96f44ca3fbe47707a02 Time: 10740ms chunk {0} runtime.6afe30102d8fe7337431.js (runtime) 1.05 kB [entry] [rendered] chunk {1} styles.5283ab92ad436ab9264c.css (styles) 116 kB [initial] [rendered] chunk {2} polyfills.bb453547f4804812c2d3.js (polyfills) 130 bytes [initial] [rendered] chunk {3} main.324541d43b39aaa6d019.js (main) 128 bytes [initial] [rendered]

ERROR in Either route or analyzedModules has to be specified!

like image 963
P Toyn Avatar asked May 17 '18 10:05

P Toyn


People also ask

What is build error in Angular?

This error occurs most commonly within your development environment (while running ng serve ) when you have created a new module on the filesystem but the Angular development environment has not picked up the new module file yet.

Does ng build default to production?

Production is the new default When you create a new Angular project, the commands ng build and ng serve use the production build by default.

How do you solve error this command is not available when running the Angular CLI outside a workspace?

To Fix Error “This command is not available when running the Angular CLI outside a workspace Error”, Do Right-Click on yours project name in VS Code and Click “Open in Integrated Terminal” Option. It would open the project to your terminal and error would be fixed.

What does ng build prod do?

The ng build command is intentionally for building the apps and deploying the build artifacts. The command does not generate an output folder. The output folder is – dist/. The ng serve builds artifacts from memory instead for a faster development experience.


1 Answers

I realised I was using version 6.0.1 of the Angular Compiler CLI with an Angular 5.2 app. I reverted the version of the Compiler CLI to 5.2.11 and the issue is resolved.

like image 115
P Toyn Avatar answered Sep 29 '22 10:09

P Toyn