【问题标题】:Error after upgrading Angular 5 to 6 , VSTS build将 Angular 5 升级到 6 后出错,VSTS 构建
【发布时间】:2019-02-04 07:17:00
【问题描述】:

从 Angular 5 升级到 6 后,我已在本地启动并运行它。它在 build 和 build --prod 中运行。我在 .NET MVC 应用程序中确实有它。但是,当 VSTS 上的构建通过时,它会弹出一些错误。它说。

node_modules\@angular\compiler\src\output\output_ast.d.ts(602,15): Error TS2474: Build:In 'const' enum declarations member initializer must be constant expression.

node_modules\@angular\core\src\render3\interfaces\container.d.ts(35,5): Error TS1169: Build:A computed property name in an interface must directly refer to a built-in symbol.

node_modules\@angular\core\src\sanitization\bypass.d.ts(55,14): Error TS2535: Build:Enum type 'BypassType' has members with initializers that are not literals.

只有在 VSTS 上的构建失败,它在 CompileTypeScriptWithTSConfig 的过程中出现:

我确实运行 typescript 版本 2.7.2 并且我已将 csproj Typescript 版本设置为 2.7 。由于 Visual Studio 不支持 2.9.2 和 Angular 6.1.4 不支持 3.0.0 版本

【问题讨论】:

    标签: angular visual-studio typescript azure-devops angular6


    【解决方案1】:

    您的 VSTS 构建必须使用早于 2.7 的 TypeScript 版本,因为错误消息 A computed property name in an interface must directly refer to a built-in symbol. 在 2.7 和更高版本中不存在。看起来您至少需要使用 2.7 来编译这些类型声明文件。我不知道是什么控制了您的 VSTS 构建的 TypeScript 版本;如果您提供更多信息,我可能会提供更多帮助。

    【讨论】:

    • 感谢帮助,日志说它使用了某个microsoft文件夹下的本地typescript版本。它是 2.3 版。我确实安装了 2.9.2 并且确实使用 npm 在全球范围内安装了它,以确保它。它工作感谢分配
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-09
    • 2019-10-26
    • 2018-11-21
    • 1970-01-01
    • 2017-08-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多