ng build --prod build在新文件夹中运行npm install后失败 [英] ng build --prod build failed after running npm install in new folder

查看:225
本文介绍了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 enhanced-resolve@3.3.0

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

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

我们已发布1.2.4/1.3.0-rc.1来解决此问题

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

我也遇到了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后失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆