生产构建错误:索引 html 生成失败 [英] Error in production build: Index html generation failed

查看:42
本文介绍了生产构建错误:索引 html 生成失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angular 10 项目升级到 Angular 12.但是现在在运行生产构建时,它给出了错误

Upgraded the Angular 10 project to Angular 12. But now on running production build, it is giving error

索引 HTML 生成失败.
未定义:6:720366 缺少 '}'

Index HTML generation failed.
undefined:6:720366 missing '}'

ng build --configuration production --aot

很难找到错误,因为它指向生成的 HTML 文件.节点日志没什么用.

It is very difficult to find the error because it points to the generated HTML file. Node log will no do much.

index.html

<!doctype html>
<html lang="en">

<head>
    <title>Quiz - Admin</title>
    <base href="/">
    <meta charset="utf-8">
</head>

<body>

<app></app>

</body>

</html>

运行开发构建时,本地没有报错,即使ng build成功完成

While running the development build, locally does not give any error, even ng build completed successfully

请在此处检查构建管道:https://github.com/anuj9196/quiz-app/runs/2589355739?check_suite_focus=true#step:7:56

Please check the build pipeline here: https://github.com/anuj9196/quiz-app/runs/2589355739?check_suite_focus=true#step:7:56

推荐答案

错误不在您在文件夹结构中看到的 index.html 文件中.它发生在生成最终的 index.html 时.这可能是 css/scss 文件中的编译错误(因为打字稿似乎可以正确编译).确保您的 css 文件中的所有大括号 } 都已关闭.

The error is not in the index.html file that you see in the folder structure. It occurs on generating the final index.html. This is a compilation error probably in the css/scss files (as the typescript seem to compile correctly). Make sure you have all curly brackets } closed in your css files.

这篇关于生产构建错误:索引 html 生成失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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