执行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后再试。

转载于:https://www.cnblogs.com/alkq1989/p/7516637.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值