本文介绍了ng build --prod build在新文件夹中运行npm install后失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是进入产品构建的错误

Here is the error getting in prod build

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之后正在安装新版本的软件包而导致错误.由于列表太长,因此无法共享软件包版本差异.它可以与aot false一起使用,但不想使用aot false进行构建.无法找出哪个包对此负责.

Getting error because new versions of packages being installed after running npm install. Cannot share packages version differences because the list is too lengthy. Its working with aot false but don't want to build with aot false. Not able to find out which package is responsible for this.

推荐答案

尝试

npm i [email protected]

或将其添加到您的shrinkwrap.jsonpackage-lock.jsonyarn.lock或像Filipe Silva所说的那样更新angular-cli

or add it to your shrinkwrap.json or package-lock.json or yarn.lockor update angular-cli as said Filipe Silva

我也遇到了enhanced-resolve问题:angular-cli不尊重我的--environment标志

I also had issue with enhanced-resolve: angular-cli didn't respect my --environment flag

另请参阅此线程

这篇关于ng build --prod build在新文件夹中运行npm install后失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:45