在新文件夹中运行npm install后,angular-ng build –prod build失败

前端之家收集整理的这篇文章主要介绍了在新文件夹中运行npm install后,angular-ng build –prod build失败前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是生成prod的错误

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/var/www/project/src'
 @ ./src/main.ts 4:0-74
 @ multi ./src/main.ts

因为在运行npm install之后安装了新版本的软件包而出现错误.无法共享软件包版本差异,因为列表太冗长.它的工作是假的,但不想用虚假的方式构建.无法找出对此负责的软件包.

解决方法

尝试

npm i enhanced-resolve@3.3.0

或者将它添加到shrinkwrap.json或package-lock.json或yarn.lock中
或更新angular-cli作为菲利普席尔瓦说

We’ve released 1.2.4/1.3.0-rc.1 to fix this issue

我也有增强解决问题:angular-cli不尊重我的–environment标志

另见此主题

> https://github.com/angular/angular-cli/issues/7113

猜你在找的Angularjs相关文章