我正在使用 Azure DevOps YAML 管道来构建/部署我的 Angular 9 应用程序。YAML 包含一个 Powershell 脚本来构建它,如下所示
- powershell: |
$angularBuildConfiguration = "MyBuildConfig";
write-host "ng-build start";
ng build --prod --aot --configuration $angularBuildConfiguration;
write-host "ng-build end";
workingDirectory: '$(Build.SourcesDirectory)\...'
displayName: 'Build app - Angular app'
以上内容通过 Angular 构建,最后返回消息“无法读取未定义的属性 'toLowerCase' 中的错误”。
我已经验证了 workingDirectory 和 angularBuildConfiguration 参数具有预期的值 - 我还用硬编码值替换了它们并获得了相同的结果。如果我在构建服务器(YAML 脚本实际运行的地方)上运行上面的 Powershell 脚本,则在预期的文件夹中构建失败并显示相同的错误消息,但是如果我在本地计算机上使用相同的脚本构建它会成功构建
我不知道这是否是一个 ng 构建问题,或者我的 Angular 9 项目中是否存在导致错误的东西 - 没有标记伴随错误消息的“关联”文件
有没有人有任何想法?