Angular 5 生产构建抛出错误 [英] Angular 5 production build throwing error

查看:24
本文介绍了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 字节 [initial] [rendered]块 {3} main.324541d43b39aaa6d019.js (main) 128 字节 [initial] [rendered]

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 Compiler 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天全站免登陆