【问题标题】:Cannot build prod version of Angular project for ASP.NET Boilerplate无法为 ASP.NET 样板构建 Angular 项目的 prod 版本
【发布时间】:2018-06-17 12:39:45
【问题描述】:

我正在尝试构建 ABP 3.4.1 的 prod 版本,但是当我运行 yarn run ng build --prod 时出现以下异常:

11% building modules 11/14 modules 3 active 
...\bootstrap\dist\css\bootstrap.min.cssNode#moveTo was deprecated. Use 
Container#append.                     Date: 2018-01-08T13:43:30.326Z
Hash: 988f3df7ec204a6033a2
Time: 21028ms
chunk {0} styles.e1f5a87bb585ebbb225d.bundle.css (styles) 414 kB [initial]
[rendered]   
chunk {1} polyfills.3bc34265385d52184eab.bundle.js (polyfills) 86 bytes 
[initial] [rendered]
chunk {2} main.e402deade8b026b7d50e.bundle.js (main) 84 bytes [initial] 
[rendered]
chunk {3} inline.a6814d03da59c81640d4.bundle.js (inline) 1.45 kB [entry] 
[rendered]

ERROR in : "let-" is only supported on ng-template elements. ("
  </thead>
  <tbody>
    <template ngFor [ngForOf]="rows" [ERROR ->]let-rowz="$implicit" let-index="index">
    <tr *ngIf="!(datePicker.onlyCurrentMonth && rowz[0].sec")
: "let-" is only supported on ng-template elements. ("
  </thead>
  <tbody>
    <template ngFor [ngForOf]="rows" let-rowz="$implicit" [ERROR ->]let-index="index">
      <tr *ngIf="!(datePicker.onlyCurrentMonth && rowz[0].secondary && rowz[6].sec")

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我无法弄清楚这个错误发生在哪里,但在搜索后我发现this post 建议我设置--aot=false 但随后我收到以下错误:

11% building modules 13/19 modules 6 active 
...\bootstrap\dist\css\bootstrap.min.cssNode#moveTo was deprecated. Use 
Container#append.                      94% asset optimization(node:2080) 
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: punc ({)
(node:2080) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 60.77s.

如何才能正确构建 prod 版本?

【问题讨论】:

    标签: aspnetboilerplate


    【解决方案1】:

    本期回答:https://github.com/valor-software/ngx-bootstrap/issues/3024

    使用 ngx-bootstrap@2.0.0-beta.8

    angular/package.json 中设置:

    "ngx-bootstrap": "^2.0.0-beta.8",
    

    【讨论】:

    • 这有帮助,但现在我收到错误 94% asset optimization(node:19940) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: punc ({) (node:19940) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    • 你清理了你的 node_modules 文件夹了吗?
    • 我删除了 node_modules 文件夹并重新安装,但仍然出现同样的错误
    • @AndreOdendaal 这个has been fixed 使用ngx-bootstrap v2.0.2(和ngx-pagination v3.0.3)。可以查吗?
    • @AndreOdendaal 这已在模板的 v3.5.0 中修复。
    猜你喜欢
    • 1970-01-01
    • 2020-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-16
    • 2018-05-22
    • 1970-01-01
    相关资源
    最近更新 更多