angular2 ng build --prod 报错:Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'

时间:2017-08-08 15:15:15   收藏:0   阅读:1895

调试页面 ng serve 正常

ng build 也正常

ng build --prod 异常:Module not found: Error: Can‘t resolve ‘./$$_gendir/app/app.module.ngfactory‘

 

开始以为是以前那样,引用错了路径或少引用了东西。

搜了好多资料,发现是 angular-cli 的版本有点低了(因为用了最新的material)

找到原因了,问题就很容易解决了

第一步:

rm -rf node_modules/

第二部:

npm install --save-dev @angular/cli@latest

第三部:重新安装依赖

npm install

 

搞定!

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!