【问题标题】:Error only on Deploy, after migrating from Angular 4 to Angular 6从 Angular 4 迁移到 Angular 6 后,仅在部署时出错
【发布时间】:2018-12-20 18:36:10
【问题描述】:

我刚刚将我的 Angular 4 应用程序迁移到 Angular 6。当我为应用程序提供服务时一切正常。我可以使用命令 ng build --configuration=production --aot 构建用于生产的应用程序而没有错误。但是在我将应用程序部署到 Azure 后,我在浏览器中收到以下错误:SyntaxError: expected expression, got '<'

【问题讨论】:

  • 你不使用ng serve构建你的应用程序。考虑使用ng build 实际构建您的应用程序。请以文本形式提供您的错误。它最初是文本,我看不出将其转换为图像的意义。
  • 对不起@trichetriche。我的错。我用于构建的命令是ng build --configuration=production --aot。我遇到的错误是 SyntaxError: expected expression, got '
  • 再次,请将您的错误作为代码发布。只知道它是什么类型的错误并没有多大帮助,我们需要知道它来自哪里。顺便说一句,您可以将您的命令缩短为 ng build --prod,这与其他一些很酷的功能相同,例如缓存破坏
  • 此错误不在我的终端中,在我的浏览器控制台中。服务和构建已在终端中完成,没有错误。这是我的申请:link。您将在浏览器控制台中看到错误。
  • 我知道它在你的应用程序中,这并不意味着你不能复制粘贴它。而且我正在打电话,我无法使用开发工具。

标签: angular azure deployment


【解决方案1】:

我四次收到相同的错误:SyntaxError: expected expression, got '。在 runtime、polyfils、scripts 和 main。如果我点击其中任何一个,我会得到相同的结果 - 我的 index.html 在我看来看起来不错:`

<!doctype html>
    <html>
    <head>
        <base href="/">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link rel="icon" type="image/x-icon" href="favicon.ico">
        <title>GSForms</title>
    <link rel="stylesheet" href="styles.857e9318f3b585c2337e.css"></head>
    <body class="app header-fixed sidebar-fixed aside-menu-fixed aside-menu-hidden">
        <app-root>Loading...</app-root>
    <script type="text/javascript" src="runtime.11fb201fd2c05ba12fc0.js"></script><script type="text/javascript" src="polyfills.20018d896dce3cebbe96.js"></script><script type="text/javascript" src="scripts.1e4e4f091818d4dc5906.js"></script>
<script type="text/javascript" src="main.259052feb397b3d6fc3b.js"></script>
</body>
</html>

`

【讨论】:

    猜你喜欢
    • 2019-03-26
    • 2020-06-15
    • 2018-10-18
    • 2023-04-08
    • 1970-01-01
    • 2018-10-18
    • 2017-08-24
    • 2021-10-26
    • 2017-01-07
    相关资源
    最近更新 更多