无法使用ng build --prod构建angular 2项目 [英] Unable build the angular 2 project using ng build --prod

查看:195
本文介绍了无法使用ng build --prod构建angular 2项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用角材料创建了一个角2项目.我正在尝试使用Firebase部署过程托管我的项目.

I have created a angular 2 project using angular material. I am trying to host my project using firebase deployment process.

我的应用程序已在服务器上成功运行.但是,当我尝试构建我的应用程序时,它给我以下错误,如下图所示.

My application is successfully running on my server.But when I am trying to build my application its giving me the following error as shown below in the image.

请帮助我解决这个问题

推荐答案

解决方案:针对let- is only support for ng-template错误.

您已经在您的HTML端的某些地方使用了let-variablename.该错误表明您不能在任何地方使用它而不是ng-template.

You have use let-variablename some where in you html side. The error says you can't use it anywhere instead of ng-template.

在使用NgForOf

如下所示,

如果您正在使用下面的这种代码.

if you are using this kind of below code.

 <div ngFor let-variableName [ngForOf]="ListOfData" let-index=index ></div>

然后应将其更改为ng-template

 <ng-template ngFor let-variableName [ngForOf]="ListOfData" let-index=index ></ng-template>

解决方案2

在下面将其用于循环

Solution 2

Use this below for loop

*ngFor="let variableName of ListOfData; let index = index"

您正在使用哪种而不是种类

instead of which is you are using kind

ngFor let-variableName [ngForOf]="ListOfData" let-i=index 

我希望以上两种解决方案都能对您有所帮助.

I hope this above both solutions are helps you.

使用以下命令代替您的

 ng build --prod --aot=false --build-optimizer=false

这篇关于无法使用ng build --prod构建angular 2项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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