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

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

问题描述

我使用 angular 材料创建了一个 angular 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.

请帮我解决这个问题

推荐答案

Solution: for 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

使用下面的循环

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

而不是你使用的是 kind

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.

使用下面的命令而不是你的命令运行

Run with this below command instead of yours

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

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

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