【问题标题】:VSTS Default Agent build fails angular 5 AppVSTS 默认代理构建失败 angular 5 App
【发布时间】:2018-01-03 17:09:10
【问题描述】:

我正在尝试在 VSTS 默认代理上构建 angular 5 App,但它失败了。我使用托管代理它显示版本错误,说它不是最新的。有没有办法做到这一点。

2018-01-01T19:04:36.3676392Z 17 error Windows_NT 6.3.9600 2018-01-01T19:04:36.3676620Z 18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build" "--prod" 2018-01-01T19:04:36.3676866Z 19 error node v6.9.1 2018-01-01T19:04:36.3677050Z 20 error npm v3.10.8 2018-01-01T19:04:36.3677231Z 21 error code ELIFECYCLE 2018-01-01T19:04:36.3677432Z 22 error pet-sys@0.0.0 build:ng build 2018-01-01T19:04:36.3677619Z 22 error Exit status 1 2018-01-01T19:04:36.3677814Z 23 error Failed at the pet-sys@0.0.0 build script 'ng build'. 2018-01-01T19:04:36.3678039Z 23 error Make sure you have the latest version of node.js and npm installed. 2018-01-01T19:04:36.3678253Z 23 error If you do, this is most likely a problem with the pet-sys package, 2018-01-01T19:04:36.3678452Z 23 error not with npm itself. 2018-01-01T19:04:36.3678673Z 23 error Tell the author that this fails on your system: 2018-01-01T19:04:36.3678861Z 23 error ng build 2018-01-01T19:04:36.3679058Z 23 error You can get information on how to open an issue for this project with: 2018-01-01T19:04:36.3679278Z 23 error npm bugs pet-sys 2018-01-01T19:04:36.3679477Z 23 error Or if that isn't available, you can get their info via: 2018-01-01T19:04:36.3679673Z 23 error npm owner ls pet-sys 2018-01-01T19:04:36.3679886Z 23 error There is likely additional logging output above. 2018-01-01T19:04:36.3680079Z 24 verbose exit [ 1, true ]'

以下链接包含托管代理构建的所有日志

logs_597

之后,我尝试使用托管在安装了最新节点和 npm 的服务器中的默认代理,并按如下方式更新 CAPABILITIES

CAPABILITIES

然后我尝试使用该代理进行构建并显示错误,

logs_602

【问题讨论】:

  • 你的构建定义是什么?你能在这里显示整个构建日志吗?
  • @MarinaLiu-MSFT 我已经更新了日志
  • 你能比较一下你在 package.json 中指定的@angular/cli 版本和你在构建代理机器上安装的版本吗?您还可以在一个驱动器中展示您的应用吗?
  • 在我的构建代理机器和项目版本相同,所以我可以在本地构建,但我不知道如何将它添加到我的构建代理中。@MarinaLiu-MSFT
  • 如果你能帮助我创建支持 node 和 msbuild 的新构建代理,我真的很感激。@MarinaLiu-MSFT

标签: node.js azure-pipelines angular5 azure-pipelines-release-pipeline


【解决方案1】:

您应该确保package.json(您正在使用1.6.1)中的angular/cli包的版本与Angular cli安装任务中已安装的包(主要安装了最新版本1.6.3)匹配。

要仔细检查您在 VSTS 代理中安装的版本,您可以在 Angular cli 安装任务之后添加 Command Line task。命令行任务设置如下:

如果版本真的是1.6.3,你应该把package.json中的angular/cli版本也改成1.6.3。然后在 VSTS 中重新构建。


另外,如果你在本地机器上构建你的应用程序成功,你可以创建一个位于同一本地机器上的私有代理,然后在你的 VSTS 构建定义中删除 Angular cli install 任务,然后由私有代理构建,它也应该构建成功。

创建私人代理的方法如下:

  1. 创建一个授权所有范围的 PAT(如果您已经拥有,则跳过此步骤):

    在安全页面(https://account.visualstudio.com/_details/security/tokens) -> 添加 -> 输入描述 -> 创建令牌 -> 复制新生成的令牌。

  2. 配置代理:

    在代理池页面,您可以创建新池 -> 下载代理 -> 解压缩下载的 .zip 文件 -> 以管理员身份运行 powershell -> cd /unzip/folder -> 然后开始配置私有代理:

    ./config,cmd

    # 输入 URL (https://account.visualstudio.com)、PAT、代理池名称作为命令提示

  3. 检查您创建的新代理是否在线:

    在代理池页面->选择新创建的->检查是否在线->如果离线->在powershell窗口中输入./run.cmd

更多关于配置私有代理的细节,可以参考Deploy an agent on Windows

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-01
    • 2016-04-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多