Angular 5生产版本抛出错误 [英] Angular 5 production build throwing error

查看:55
本文介绍了Angular 5生产版本抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用5.2版的Angular应用程序,在构建生产版本时会引发以下错误(在本地运行该应用程序或运行标准构建时不会引发该错误)

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.

根据要求,这里是错误堆栈
ng build --prod

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

日期:2018-05-17T10:23:10.379Z 哈希:a96f44ca3fbe47707a02 时间:10740ms 块{0} runtime.6afe30102d8fe7337431.js(运行时)1.05 kB [entry] [rendered] 块{1} styles.5283ab92ad436ab9264c.css(样式)116 kB [initial] [rendered] 块{2} polyfills.bb453547f4804812c2d3.js(polyfills)130个字节[初始] [呈现] 块{3} main.324541d43b39aaa6d019.js(主要)128个字节[初始] [呈现]

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!

推荐答案

我意识到我正在将Angular编译器CLI的6.0.1版本与Angular 5.2应用程序一起使用.我将Compiler CLI的版本恢复为5.2.11,此问题已解决.

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.

这篇关于Angular 5生产版本抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆