执行ng build --prod --aot命令报错

D:\git\**\src\main\iui>ng build --prod --aot
Hash: 257ab60feca43633b6f7
Time: 25358ms
chunk {0} polyfills.221420fde500aaed5079.bundle.js (polyfills) 184 kB {5} [initial] [rendered]
chunk {1} scripts.92391f7b3a5602225e85.bundle.js (scripts) 185 kB {5} [initial] [rendered]
chunk {2} styles.429bdc2066b527f64acc.bundle.css (styles) 281 bytes {5} [initial] [rendered]
chunk {3} main.bfbde393948c0a677c68.bundle.js (main) 1.1 kB {4} [initial] [rendered]
chunk {4} vendor.d9800c734c7708c02954.bundle.js (vendor) 851 kB [initial] [rendered]
chunk {5} inline.d70fd8c806a11fd8fd6e.bundle.js (inline) 0 bytes [entry] [rendered]

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'D:\git\**\src\main\iui\src'
@ ./src/main.ts 3:0-74
@ multi ./src/main.ts

ERROR in ./src/$$_gendir async
Module not found: Error: Can't resolve 'D:\git\**\src\main\iui\src\$$_gendir\app\upgrade\upgrade.module.ngfactory.ts' in 'D:\git\**\src\main\iui\src\$$_gendir'
@ ./src/$$_gendir async
@ ./~/@angular/core/@angular/core.es5.js
@ ./src/main.ts
@ multi ./src/main.ts

 

如上,执行ng build --prod --aot会报错,去掉–aot后可正常编译通过。网上查找解决方法可升级@angular/cli版本,或者执行 npm install enhanced-resolve@3.3.0 命令,本人使用第二种方法成功解决了问题,第二种不成功可升级cli后再试。

posted @ 2017-09-13 18:25  青青鸟  阅读(697)  评论(0编辑  收藏  举报